Merge a pull request

(Description borrowed from official documentation at https://github.com/octokit/plugin-rest-endpoint-methods.js/blob/master/docs/pulls/merge.md) --- This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. See "Secondary rate limits" and "Dealing with secondary rate limits" for details.

Script github

by lplit ยท 8/26/2022

  • Submitted by lplit Deno
    Created 1352 days ago
    1
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
    2
    import { Octokit } from "https://cdn.skypack.dev/octokit?dts";
    3
    
    
    4
    /*
    5
    @param: {wmill.Resource<"github">} gh_auth - Resource containing Github Auth API Key
    6
    example:
    7
    {
    8
        auth: github_api_key
    9
    }
    10
    */
    11
    
    
    12
    export async function main(
    13
      gh_auth: wmill.Resource<"github">,
    14
      owner: string,
    15
      repo: string,
    16
      pullNumber: string,
    17
      mergeMethod: "merge" | "squash" | "rebase" = "merge",
    18
      commitTitle?: string,
    19
      commitMessage?: string,
    20
      sha?: string,
    21
    ) {
    22
      const octokit = new Octokit(gh_auth);
    23
      const response = await octokit.rest.pulls.merge({
    24
        owner: owner,
    25
        repo: repo,
    26
        pull_number: pullNumber,
    27
        merge_method: mergeMethod,
    28
        commit_title: commitTitle,
    29
        commit_message: commitMessage,
    30
        sha: sha,
    31
      });
    32
    
    
    33
      return response;
    34
    }
    35