List Commits

Script gitlab Verified

by sebastienfa6ll ยท 6/6/2022

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 164 days ago
1
//native
2
export async function main(glab: RT.Gitlab, projectId: string) {
3
  const url = `${glab.baseUrl}/api/v4/projects/${projectId}/repository/commits`;
4
  const issue = await fetch(`${url}`, {
5
    headers: {
6
      Authorization: `Bearer ${glab.token}`,
7
      "Content-Type": "application/json",
8
    },
9
  });
10
  return await issue.json();
11
}
12

Other submissions
  • Submitted by lplit Deno
    Created 1371 days ago
    1
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
    2
    /*
    3
    @param: {wmill.Resource<"gitlab">} glab - Resource containing Gitlab Auth API Key
    4
    Example:
    5
    {
    6
      auth: gitlab_api_key
    7
    }
    8
    */
    9
    export async function main(
    10
      glab: wmill.Resource<"gitlab">,
    11
      projectId: string,
    12
    ) {
    13
      const url = `https://gitlab.com/api/v4/projects/${projectId}/repository/commits`;
    14
      const issue = await fetch(`${url}`, {
    15
        headers: {
    16
          "Authorization": `Bearer: ${glab.token}`,
    17
          "Content-Type": "application/json",
    18
        }
    19
      });
    20
      return await issue.json();
    21
    }
    22
    
    
  • Submitted by jaller94 Deno
    Created 386 days ago
    1
    /*
    2
    @param: {Gitlab} glab - Resource containing Gitlab Auth API Key
    3
    Example:
    4
    {
    5
      baseUrl: "https://gitlab.com"
    6
      token: gitlab_api_key
    7
    }
    8
    */
    9
    type Gitlab = {
    10
      baseUrl: string;
    11
      token: string;
    12
    };
    13
    export async function main(glab: Gitlab, projectId: string) {
    14
      const url = `${glab.baseUrl}/api/v4/projects/${projectId}/repository/commits`;
    15
      const issue = await fetch(`${url}`, {
    16
        headers: {
    17
          Authorization: `Bearer: ${glab.token}`,
    18
          "Content-Type": "application/json",
    19
        },
    20
      });
    21
      return await issue.json();
    22
    }
    23