Skip to content

Latest commit

 

History

History
86 lines (64 loc) · 4.37 KB

README.md

File metadata and controls

86 lines (64 loc) · 4.37 KB

Auto Pull Request Merge

CI GitHub Marketplace Mergify Status

A GitHub Action that merges a pull request automatically by the latest commit check status.

Other GitHub Actions that do merge automatically are like merging based on some user input. This GitHub Actions is designed to merge automatically when a pull request comes in.

This action extract the number from a pull request which has triggered this by default. You don't need to specify the pull request number by ${{ github.event.pull_request.number }}.

Usage

      - name: Merge
        uses: KeisukeYamashita/auto-pull-request-merge@v1

Trigger by pull_request event with custom check

This is just an example to show one way in which this action can be used.

on: pull_request
jobs:
  auto-merge:
    - name: Merge
      uses: KeisukeYamashita/auto-pull-request-merge@v1
      with:
        intervalSeconds: 10
        timeoutSeconds: 30

Action inputs

Name Description Default
checkStatus Check all status before merge' true
comment Comments to post before merging the pull request -
dryRun Dry run the merge or not false
failStep Fail the step if no PR has merged true
ignoreLabels Label that the target pull request shouldn't have -
ignoreLabelsStrategy Check condition on how to check the labels (Options are all, atLeastOne). all
labels Label that the target pull request should have -
labelsStrategy Check condition on how to check the labels (Options are all, atLeastOne). all
intervalSeconds Seconds between the check 0.1
repository The GitHub repository containing the pull request Current repository
pullRequestNumber The number of the pull request. github.event.pull_request.number
sha SHA of the commit. github.event.pull_request.head.number
strategy How to merge. merge, squash and rebase is supported. merge
timeoutSeconds Seconds to timeout this action 60
token GITHUB_TOKEN or a repo scoped PAT. GITHUB_TOKEN

Action outputs

Name Description
commentID ID of the comment if you specify comment in input
merged If the PR has merged or not

Disclaimer

GitHub API rate limit consumption

When a Pull Request is created, this GitHub Actions polls the commit status of the Pull Request and if it's ready to merge, it will merge it. You can set the interval by intervalSeconds, but depending on the user's input, you may be subject to an inordinate number of API calls. Be careful when setting this up.

GitHub Actions charge and quota

GitHub Actions are charged by runtime, and quotas are set for some users on free plans and other plans. This action checks for other statuses to pass, so it can take a lot of time to run. By default, it is set to time out after 1 minute, but you can change by timeoutSeconds if you need to.

License

MIT