Giter VIP home page Giter VIP logo

automerge-pr-action's Introduction

automerge-pr-action

This action polls for required checks within a branch, waits for successful completion, and automatically merges a pull request.

It grabs required check names from your branch protection rules via query of GitHub's API, polls until they are complete, and merges if they are successful.

If there are no required checks - as long as there are no merge conflicts, the PR can be merged successfully.

Inputs

Name Description Required Default
repoOwner The owner of the repository with the PR you wish to automatically merge false bandwidth
repoName The name of the repo with the PR in question true N/A
prNumber The PR number to automatically merge true N/A
token GH user token with permission to merge PRs and read branch and checks information true N/A
maxRetries The amount of times to retry requests for checks status (string) false '10'
retryDelay Amount of time (in seconds) to wait between retries (string) false '60'

Example Usage

jobs:
  merge:
    if: ${{ github.event.action == 'Merge' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set PR number as env variable
        run: |
          echo "PR_NUMBER=$(hub pr list -h ${{ github.event.client_payload.branchName }} -f %I)" >> $GITHUB_ENV

      - uses: bandwidth/[email protected]
        with:
          repoOwner: my-org-that-isnt-bandwidth
          repoName: my-cool-repo
          prNumber: ${{ env.PR_NUMBER }}
          token: ${{ secrets.MY_BOT_GH_USER_TOKEN }}
          maxRetries: '5'
          retryDelay: '30'

      - uses: actions/github-script@v6
        if: failure()
        with:
          script: |
            github.rest.issues.createComment({
              issue_number: ${{ env.PR_NUMBER }},
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: 'Failed to auto-merge this PR. Check workflow logs for more information'
            })

automerge-pr-action's People

Contributors

ajrice6713 avatar noahg1 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.