Skip to content

Commit e68091b

Browse files
authored
Auto merge main branch on update for branches with auto-merge enabled (#306)
Adds auto-updating of PR branches with the content of the base branch, if the PR branch is marked for auto-merge in Github. I have examined the Typescript code in https://github.com/tibdex/auto-update/blob/main/src/index.ts for security but have not examined the Javascript that it compiles into, and I have also examined the Github Action that they use to release new Github Actions versions. This PR specifically locks the branch to tag v2.1.2 rather than v2; the underlying release process reassigns the vX and vX.Y tag on minor and patch releases, and this hopefully minimizes (although does not eliminate) the possibility of malicious code being introduce into the action. Note that we have set up the action to only trigger on pushes to `main` branch; if a PR has a base branch that is not `main`, the action is not triggered automatically. However, the next time main is pushed to, it will run on all branches, including branches where main is not the target. In the case of merge conflicts, the action will add a comment to the PR and not merge, which should hopefully notify the PR author to take action. This is intended to be a replacement for the use of CZI's auto-merge bot; the combination of this Github Action and Github auto-merge should fully replace the need for the bot.
1 parent 14ec2cc commit e68091b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/auto-update.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Auto-update
2+
# Auto-update only listens to `push` events.
3+
# If a pull request is already outdated when enabling auto-merge, manually click on the "Update branch" button a first time to avoid having to wait for another commit to land on the base branch for the pull request to be updated.
4+
# on: push
5+
# If pull requests are always based on the same branches, only triggering the workflow when these branches receive new commits will minimize the workflow execution.
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
Auto:
13+
name: Auto-update
14+
runs-on: ubuntu-18.04
15+
steps:
16+
- uses: tibdex/[email protected]
17+
with:
18+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)