List Repo Branches

Script gitlab

by rosset3s2p4u ยท 6/6/2022

  • Submitted by lplit Deno
    Created 1333 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
      baseUrl: "https://www.gitlab.com" 
    8
    }
    9
    */
    10
    export async function main(
    11
      glab: wmill.Resource<"gitlab">,
    12
      projectId: string,
    13
    ) {
    14
      const url = `${glab.baseUrl}/api/v4/projects/${projectId}/repository/branches`;
    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