Code Monkey home page Code Monkey logo

auto-merge-bot's Introduction

Auto-Merge-Bot

Bot which enables or disable auto-merge in a repository.

Why?

This action was developed to help external parties merge their own Pull Requests.

If an external party makes a PR, and it is approved, they still cannot merge it. This bot gives them the ability to enable the auto-merge function so, once their PR gets approved, it is merged.

Configuration

Be sure that Allow auto-merge is enabled in the repository options.

Create a file named .github/workflows/auto-merge-bot.yml and add the following:

name: Auto Merge Bot

on:
  # GitHub considers PRs as issues
  issue_comment:
    types: [created]

jobs:
  set-auto-merge:
    runs-on: ubuntu-latest
    # Important! This forces the job to run only on comments on Pull Requests that starts with '/merge'
    if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/merge') }}
    steps:
      - name: Set auto merge
        uses: paritytech/auto-merge-bot@main
        with:
          GITHUB_TOKEN: '${{ github.token }}'
          MERGE_METHOD: "SQUASH"

Inputs

You can find all the inputs in the action file, but let's walk through each one of them:

  • GITHUB_TOKEN: Token to access to the repository.
    • required
    • This is provided by the repo, you can simply use ${{ github.token }}.
  • MERGE_METHOD: Type of merge to enable.
    • Optional: Defaults to SQUASH.
    • Available types are MERGE, REBASE and SQUASH.
      • Make sure that the type of merge you selected is available in the repository merge options.
  • SILENT: If the bot should be silent and not comment when enabling/disabling auto-merge.
    • Optional: Defaults to false.
  • ALLOWLIST: List of user accounts which are allowed to use the bot aside from the author and org members.
    • Optional
    • Must be a comma separated value: user-1,user-2,user-3.

Usage

To trigger the bot, you need to write a comment in a Pull Request where the action is installed. The available actions are:

  • /merge: Enables auto-merge for Pull Request
  • /merge cancel: Cancels auto-merge for Pull Request
  • /merge help: Shows this menu

The bot can only be triggered by the author of the PR or by users who publicly belongs to the organization of the repository.

By publicly, I refer to the members of an organization which can be seen by external parties. If you are not sure if you are part of an organization, simply open https://github.com/orgs/**your_organization**/people in a private window. If you don’t see your name there, you are not a public member.

Find related docs here: Publicizing or hiding organization membership.

Deployment

To deploy a new version you need to update two files:

  • package.json: Update the version number.
  • action.yml: Update the image number in runs.image. Important: Both versions must have the same number.

When a commit is pushed to the main branch and the versions have changed, the system will automatically tag the commit and release a new package with such version.

You can find all the available versions in the release section.

auto-merge-bot's People

Contributors

bullrich avatar

auto-merge-bot's Issues

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.