Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
git-merge

GitHub Action

auto-pull-request-merge

v1

auto-pull-request-merge

git-merge

auto-pull-request-merge

Auto PR Merge

Installation

Copy and paste the following snippet into your .yml file.

              

- name: auto-pull-request-merge

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

Learn more about this action in KeisukeYamashita/auto-pull-request-merge

Choose a version

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 -
failStep Fail the step if no PR has merged true
ignoreLabels Label that the target pull request shouldn't have -
labels Label that the target pull request should have -
intervalSeconds Seconds between the check 0.1
repostiory 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
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

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