https://github.com/int128/renovate-merge-bot
Assist automerge of Renovate pull requests in GitHub Actions
https://github.com/int128/renovate-merge-bot
automerge github-actions renovate
Last synced: 7 months ago
JSON representation
Assist automerge of Renovate pull requests in GitHub Actions
- Host: GitHub
- URL: https://github.com/int128/renovate-merge-bot
- Owner: int128
- License: apache-2.0
- Created: 2023-04-30T00:44:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-19T05:07:45.000Z (12 months ago)
- Last Synced: 2024-10-19T11:32:01.430Z (12 months ago)
- Topics: automerge, github-actions, renovate
- Language: TypeScript
- Homepage:
- Size: 11.2 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# renovate-merge-bot [](https://github.com/int128/renovate-merge-bot/actions/workflows/ts.yaml)
This is an action for auto-merge of Renovate pull requests.
## Purpose
### Problem to solve
Renovate supports the great feature of [automerge](https://docs.renovatebot.com/key-concepts/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.
### How to solve
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 agoFinally, a pull request is automatically merged even if a commit was added using `GITHUB_TOKEN`.
Here is the example of [#5](https://github.com/int128/renovate-merge-bot/pull/5).
## Getting Started
### Create GitHub App
Create your GitHub App from [this link](https://github.com/settings/apps/new?webhook_active=false&url=https://github.com/int128/renovate-merge-bot&contents=write&pull_requests=write&workflows=write).
Here are the required permissions:- Contents: read and write
- Pull Requests: read and write
- Workflows: read and writeInstall the GitHub App to your repositories.
### Create repository and workflow
Create a new repository.
Add the following secrets:- `BOT_APP_ID` = App ID of the GitHub App
- `BOT_APP_PRIVATE_KEY` = Private key of the GitHub AppCreate a workflow.
```yaml
name: runon:
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 }}
```### Confirm the behavior
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)## Specification
### Inputs
| Name | Default | Description
|------|----------|------------
| `github-app-id` | (required) | GitHub App ID
| `github-app-private-key` | (required) | GitHub App private key
| `dry-run` | `false` | Dry-run### Outputs
None.