You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚠️**WIP: Please wait until version 1.0.0 before using this.** ⚠️
3
+
Name: `alexwilson/enable-github-automerge-action`
4
4
5
-
## What is this?
5
+
## 1) What is this?
6
6
7
-
A Github action for enabling [Github Auto-Merge](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/automatically-merging-a-pull-request) in a workflow for a pull-request.
8
-
You might want to use this for automatically merging Dependabot pull-requests.
7
+
To speed up some of your workflows, this action allows you to automatically enable [Auto-Merge](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/automatically-merging-a-pull-request) in your Github pull-requests.
8
+
9
+
When enabled, Auto-Merge will merge pull-requests automatically _as soon as all requirements are met_ (approvals, passing tests).
10
+
11
+
_You can use this, for example, to automatically merge Dependabot pull-requests_.
12
+
13
+
This action pairs well with [`hmarr/auto-approve-action`](https://github.com/hmarr/auto-approve-action)
14
+
15
+
## 2) Usage
16
+
17
+
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](./.github/workflows/auto-merge-dependabot.yml).
*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](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif).
- **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).
43
+
- **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](https://docs.github.com/en/graphql/reference/enums#pullrequestmergemethod).
44
+
45
+
## 3) Developing Locally
46
+
47
+
Github Action developer-experience isn't fantastic, so for now we mimic the Github Action environment in `./src/local.ts`.
48
+
49
+
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`.
50
+
51
+
1. Make sure you're running a recent version of Node (the correct version will always be in `.nvmrc` and `action.yml`)
52
+
2. Set `GITHUB_TOKEN` locally. (You can do this via `$ export GITHUB_TOKEN=blah`)
53
+
3. Optionally(!) set `MERGE_METHOD` locally. (You can do this via `$ export MERGE_METHOD=MERGE`)
54
+
4. Run with `npm run local`.
55
+
5. **Important**: Avoid committing anything to `dist/*` — this is automatically regenerated and manually adjusting this will make rebasing harder!
0 commit comments