GithubHelp home page GithubHelp logo

joshuasimon-taulia / automerge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reitermarkus/automerge

0.0 0.0 0.0 13.18 MB

Automatically merge approved pull requests with successful checks.

License: MIT License

TypeScript 100.00%

automerge's Introduction

CI Status

Automerge Action

This action automatically enables “auto-merge” for pull requests under the following conditions:

  • The pull request is not a draft.
  • The associated branch has at least one required status check.
  • All required labels (if any) are applied.
  • No “do not merge” labels are applied.

Ensure the following is set up in your repository settings before enabling this action:

  • The “Require pull request reviews before merging” rule and the additional “Dismiss stale pull request approvals when new commits are pushed” rule are enabled for the branch. This ensures that no changes to the pull request are possible between the approval and the automatic merging.

  • The “Require status checks to pass before merging” rule is enabled and at least one status check is selected.

    Consider also adding this action as an additional required status check. Read the Known Issues section on why.

  • “Allow auto-merge” is enabled.

Inputs

Name Required Description
token yes A GitHub Token other than the default GITHUB_TOKEN needs to be specified in order to be able to enable auto-merge.
merge-method no Specify which merge method to use. By default, will select the first one available in this order: merge, squash, rebase
squash-title no (deprecated) Use the pull request title as the commit message when squashing. Prefer setting sqaush-commit-title and squash-commit-message.
squash-commit-title no Set the squash commit title to the supplied string. Available template variables include ${pull_request.title} and ${pull_request.number}.
squash-commit-message no Set the squash commit body to the supplied string. Available template variables include ${pull_request.body}.
do-not-merge-labels no When any of the labels in this comma-separated list is applied to a pull request, it will not be merged automatically. Additionally, any labels matching the text do not merge or don't merge in any form (i.e. matching /dono?tmerge/ with whitespace and special characters removed) are always treated this way.
required-labels no Comma-separated list of labels that are required to be applied to a pull request for it to be merged automatically.
pull-request no Try merging the specified pull request automatically. For example, you can pass an input from a workflow_dispatch event.
pull-request-author-associations no Comma-separated list of required author associations for the pull request author. (By default, pull requests by any author are allowed.)
review no Try merging the pull request associated with the specified review ID automatically. For example, you can pass an input from a workflow_dispatch event. The pull-request input is also required if this is specified.
review-author-associations no Comma-separated list of required author associations for the review author. (By default, pull requests reviewd by OWNERs, MEMBERs and COLLABORATORs are allowed.)
dry-run no If set to true, will not actually merge pull requests but still perform all other checks.

Example Workflow

name: Automerge

on:
  # Try enabling auto-merge for all open pull requests.
  # (Only recommended for testing.)
  push:

  # Try enabling auto-merge for all open pull requests.
  schedule:
    - cron: 0 * * * *

  # Try enabling auto-merge when a pull request is approved. Note that this
  # event skips the check for the pull request author association and instead
  # checks the review author association.
  pull_request_review:
    types:
      - submitted

  # Try enabling auto-merge for a pull request when a draft is marked as
  # “ready for review”, when a required label is applied or when a
  # “do not merge” label is removed, or when a pull request is updated in
  # any way (opened, synchronized, reopened, edited).
  pull_request_target:
    types:
      - opened
      - synchronize
      - reopened
      - edited
      - labeled
      - unlabeled
      - ready_for_review

  # Try enabling auto-merge for the specified pull request,
  # review or all open pull requests if none is specified.
  workflow_dispatch:
    inputs:
      pull-request:
        description: Pull Request Number
        required: false
      review:
        description: Review ID
        required: false

jobs:
  automerge:
    runs-on: ubuntu-latest
    steps:
      - uses: reitermarkus/automerge@v2
        with:
          token: ${{ secrets.MY_GITHUB_TOKEN }}
          merge-method: rebase
          do-not-merge-labels: never-merge
          required-labels: automerge
          pull-request: ${{ github.event.inputs.pull-request }}
          review: ${{ github.event.inputs.review }}
          dry-run: true

Known Issues

If the action is triggered via a label on a pull request that is already ready to merge, the GitHub auto-merge feature cannot be enabled on that pull request anymore. A workaround is to add the workflow containing this actions as a required status check. This way the pull request will become unmergable while the action is running, allowing auto-merge to be enabled.

automerge's People

Contributors

dependabot[bot] avatar reitermarkus avatar renovate[bot] avatar renovate-bot avatar timon avatar markelliot avatar joshuasimon-taulia avatar carrodher avatar rgmvisser avatar reitermarkus[bot] 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.