Skip to content

A GitHub action that manages pull request integrations

License

Notifications You must be signed in to change notification settings

comnoco/merge-bot

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

PR Merge Bot

This action manages pull request integrations by allowing a structured workflow to be defined.

The workflow can use required labels, blocking labels, and require that reviewers sign-off for determining if a pull request should be integrated. By default the pull request will be blocked by incomplete/failing checks.

Once conditions are met the pull request will be integrated and branch deleted.

merged GitHub pull request and deleted branch

Inputs

test

Runs in test mode and will comment rather than merge. This allows you to experiment with the settings without integrating a pull request. Default is false.

test mode comment left by the bot

reviewers

Reviewers required, and reviewers must all approve. This enforces a reviewer mode where there cannot be any pending reviews and the submitted reviews must be in an "approved" state. Default is true.

reviewer has signed-off on pull request

labels

One or more labels required for integration. Default is "ready".

merge and sign-off GitHub labels

blocking_labels

One or more labels that block the integration. Default is "do not merge".

do not merge GitHub label

checks_enabled

All checks must be completed to be eligible to integrate (this does not include the currently running Action). Note, if triggering multiple runs simultaneously (like adding two labels) this will not pass -- USE WITH CAUTION. Default is false.

method

Merge method to use. Possible values are merge, squash or rebase. Default is merge.

delete_source_branch

Delete the source branch of the pull request after merging. Set to false when "Automatically delete head branches" is enabled on your repo. Default is true.

NOTE: if enabled, merge-bot is unable to delete a branch from a fork.

Automatically delete head branches enabled

Example usage

You can use PR Merge Bot by configuring a YAML-based workflow file, e.g. .github/workflows/merge-bot.yml.

name: Merge Bot

on:
  pull_request:
    types:
      - labeled
      - ready_for_review
      - review_request_removed
      - review_requested
      - synchronize
      - unlabeled
  pull_request_review:
    types:
      - dismissed
      - submitted

jobs:
  merge:
    runs-on: ubuntu-latest
    name: Merge
    steps:
    - name: Integration check
      uses: squalrus/[email protected]
      with:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        test: true
        reviewers: true
        labels: ready, merge
        blocking_labels: do not merge
        checks_enabled: true
        method: squash
        delete_source_branch: true

About

A GitHub action that manages pull request integrations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%