Giter VIP home page Giter VIP logo

enable-github-automerge-action's Introduction

Enable Github Auto-Merge Action

Name: alexwilson/enable-github-automerge-action

1) What is this?

To speed up some of your workflows, this action allows you to automatically enable Auto-Merge in your Github pull-requests.

When enabled, Auto-Merge will merge pull-requests automatically as soon as all requirements are met (approvals, passing tests).

You can use this, for example, to automatically merge Dependabot pull-requests.

This action pairs well with hmarr/auto-approve-action

2) Usage

Add as a step inside a GitHub workflow, e.g. .github/workflows/auto-merge.yml. You can see an example of this in this repository.

name: Auto-Merge
on: pull_request

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: alexwilson/enable-github-automerge-action@main
      with:
        github-token: "${{ secrets.GITHUB_TOKEN }}"

Note: You will probably want to add some restrictions so this doesn't auto-merge every PR: these are handled fairly well by GitHub Workflow syntax, you can read more about this here.

2.1) Additional Options

    - uses: alexwilson/[email protected]
      with:
        github-token: "${{ secrets.GITHUB_TOKEN }}"
        merge-method: "SQUASH"
  • github-token: The Github Token to use for this action. By default this variable is set to run as github-actions, however you can replace this with another user/actor's Github Token (make sure it has, at minimum, repo scope).
  • merge-method: Override the merge method. By default this action attempts to select your repository's default merge method, and falls back to merge. One of MERGE, SQUASH or REBASE. Read more here.

3) Developing Locally

Github Action developer-experience isn't fantastic, so for now we mimic the Github Action environment in ./src/local.ts.

This file sets environment variables locally to enable action inputs, and points to a sample pull-request webhook event in ./stub/example-pull-request.json.

  1. Make sure you're running a recent version of Node (the correct version will always be in .nvmrc and action.yml)
  2. Set GITHUB_TOKEN locally. (You can do this via $ export GITHUB_TOKEN=blah)
  3. Optionally(!) set MERGE_METHOD locally. (You can do this via $ export MERGE_METHOD=MERGE)
  4. Run with npm run local.
  5. Important: Avoid committing anything to dist/* โ€” this is automatically regenerated and manually adjusting this will make rebasing harder!

enable-github-automerge-action's People

Contributors

alexwilson avatar banyan avatar dependabot[bot] avatar github-actions[bot] avatar jakechampion avatar

Watchers

 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.