This is an action for auto-merge of Renovate pull requests.
Renovate supports the great feature of automerge, but we need to consider the following edge cases:
If any commit is added to a pull request, Renovate does not merge it.
If the commit status is unknown, Renovate does not merge it.
For example, a workflow adds a commit using GITHUB_TOKEN
which does not trigger GitHub Actions.
If the following conditions are satisfied, this action adds an empty commit to trigger GitHub Actions.
- The pull request is open
- The pull request is created by Renovate
- The pull request is mergeable
- The commit status is unknown
- The last committer is
GITHUB_TOKEN
If the following conditions are satisfied, this action merges it.
- The pull request is open
- The pull request is created by Renovate
- The pull request is mergeable
- The commit status is success
- The last commit was created at least 1 hour ago
Finally, a pull request is automatically merged even if a commit was added using GITHUB_TOKEN
.
Here is the example of #5.
Create your GitHub App from this link. Here are the required permissions:
- Contents: read and write
- Pull Requests: read and write
- Workflows: read and write
Install the GitHub App to your repositories.
Create a new repository. Add the following secrets:
BOT_APP_ID
= App ID of the GitHub AppBOT_APP_PRIVATE_KEY
= Private key of the GitHub App
Create a workflow.
name: run
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
renovate-merge-bot:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: int128/renovate-merge-bot@v1
with:
github-app-id: ${{ secrets.BOT_APP_ID }}
github-app-private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
When the workflow runs, this action finds open pull requests from repositories which the GitHub App is installed. It executes either of the following actions:
- Add an empty commit to trigger GitHub Actions
- Merge the pull request
- Leave (it will be merged by user)
Name | Default | Description |
---|---|---|
github-app-id |
(required) | GitHub App ID |
github-app-private-key |
(required) | GitHub App private key |
dry-run |
false |
Dry-run |
None.