Code Monkey home page Code Monkey logo

automerge's Introduction

automerge build-test status

Automerge Action

This action allows merging pull requests automatically if they have been approved and status checks have passed. GitHub's branch protection rules are used to determine if auto-merging is allowed for a specific branch.

Auto-merging is enabled for a branch given the following criteria:

  • 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.

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 trigger other workflows.
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 Use the pull request title as the commit message when squashing.
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.
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-author-associations no Comma-separated list of required author associations for the review author. (By default, reviews by authors which are a COLLABORATOR, MEMBER or OWNER 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 merging all open pull requests. (Only recommended for testing.)
  push:

  # Try merging all open pull requests.
  schedule:
    - cron: 0 * * * *

  # Try merging pull requests belonging to a workflow run.
  workflow_run:
    workflows:
      - CI
    types:
      - completed

  # Try merging pull requests belonging to a check suite.
  check_suite:
    types:
      - completed

  # Try merging a pull request when it is approved.
  pull_request_review:
    types:
      - submitted

  # Try merging 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.
  pull_request_target:
    types:
      - labeled
      - unlabeled
      - ready_for_review

  # Try merging the specified pull request or all open pull requests if none is specified.
  workflow_dispatch:
    inputs:
      pull-request:
        description: Pull Request Number
        required: false

jobs:
  automerge:
    if: github.event.review.state == 'approved' || !github.event.review
    runs-on: ubuntu-latest
    steps:
      - uses: reitermarkus/automerge@v1
        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 }}
          dry-run: true

automerge's People

Contributors

dependabot[bot] avatar reitermarkus avatar timon avatar rgmvisser avatar

Stargazers

Roman 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.