Skip to content

Commit 4ef21f0

Browse files
committed
skip: merge (7cfe495) [skip release]
2 parents ddd9f5a + 7cfe495 commit 4ef21f0

13 files changed

Lines changed: 1085 additions & 326 deletions

File tree

.github/auto-approve.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Auto-Approve Bot Configuration
2+
botUsernames:
3+
- bfra-me[bot]
4+
- dependabot[bot]
5+
- renovate[bot]
6+
approvalTriggers:
7+
- '**Automerge**: Enabled'
8+
requirePassingChecks: true
9+
requiredChecks:
10+
- ci
11+
- release
12+
excludeLabels:
13+
- do-not-merge
14+
- wip

.github/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ branches:
1212
protection:
1313
required_status_checks:
1414
strict: true
15-
contexts: [CI, Release, Renovate / Renovate]
15+
contexts: [Auto-approve, CI, Release, Renovate / Renovate]
1616
enforce_admins: true
1717
required_pull_request_reviews: null
1818
restrictions: null
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Auto Approve
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
pull_request_review:
9+
types:
10+
- dismissed
11+
check_run:
12+
types:
13+
- completed
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
auto-approve:
20+
name: Auto-approve
21+
permissions:
22+
pull-requests: write
23+
runs-on: ubuntu-latest
24+
steps:
25+
- id: get-workflow-access-token
26+
name: Get Workflow Access Token
27+
uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6
28+
with:
29+
app-id: ${{ secrets.APPLICATION_ID }}
30+
private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
31+
32+
- name: Checkout repository
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
with:
35+
persist-credentials: false
36+
token: ${{ steps.get-workflow-access-token.outputs.token }}
37+
38+
- name: Auto-approve PR
39+
uses: ./
40+
with:
41+
github-token: ${{ steps.get-workflow-access-token.outputs.token }}
42+
config-path: .github/auto-approve.yml

README.md

Lines changed: 126 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,138 @@
11
<h3 align="center">
22
<img alt="transparent" src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
3-
bfra.me GitHub App Template
3+
Auto-Approval Bot
44
<img alt="transparent" src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
55
</h3>
66

77
<p align="center">
88
<a href="https://github.com/bfra-me/github-app/actions?query=workflow%3Aci" title="Search GitHub Actions for CI workflow runs" ><img alt="GitHub Workflow CI Status" src="https://img.shields.io/github/actions/workflow/status/bfra-me/github-app/ci.yaml?branch=main&style=for-the-badge&logo=github%20actions&logoColor=white&label=ci"></a>
99
</p>
1010

11-
> This repository is an example of how to create a GitHub Action using Probot
11+
A GitHub App built with Probot that automatically approves pull requests from specific bots with configured trigger phrases. Perfect for handling Renovate, Dependabot or other automated PRs that can be safely merged without manual review.
12+
13+
## Features
14+
15+
- Automatically approves PRs from configured bot users
16+
- Configurable approval triggers in PR bodies
17+
- Option to require all checks to pass before approval
18+
- Specify particular checks that must pass for approval
19+
- Exclude PRs with specific labels from auto-approval
20+
- Re-approves PRs when approvals are dismissed
21+
- Works as a GitHub App or GitHub Action
22+
- Fully tested and follows best practices
23+
24+
## Configuration
25+
26+
Create a `.github/auto-approve.yml` (or `.yaml`) with the following options:
27+
28+
```yaml
29+
# Bot usernames whose PRs should be auto-approved
30+
botUsernames:
31+
- renovate[bot]
32+
- dependabot[bot]
33+
- mend-for-github-com[bot]
34+
35+
# Phrases in PR body that indicate the PR should be auto-approved
36+
approvalTriggers:
37+
- "**Automerge**: Enabled"
38+
39+
# Whether to require all checks to pass before approving
40+
requirePassingChecks: true
41+
42+
# Specific checks that must pass for auto-approval (if empty and requirePassingChecks is true, all checks must pass)
43+
requiredChecks:
44+
- build
45+
- test
46+
47+
# Labels that will prevent auto-approval if present on the PR
48+
excludeLabels:
49+
- do-not-merge
50+
- wip
51+
```
52+
53+
## Usage
54+
55+
### As a GitHub Action
56+
57+
Create a workflow file (e.g., `.github/workflows/auto-approve.yaml`):
58+
59+
```yaml
60+
name: Auto Approve
61+
62+
on:
63+
pull_request:
64+
types: [opened, reopened, synchronize, labeled, edited]
65+
pull_request_review:
66+
types: [dismissed]
67+
check_run:
68+
types: [completed]
69+
70+
permissions:
71+
contents: read
72+
pull-requests: write
73+
checks: read
74+
75+
jobs:
76+
auto-approve:
77+
runs-on: ubuntu-latest
78+
name: Auto Approve PRs
79+
steps:
80+
- uses: bfra-me/github-app@v1
81+
with:
82+
github-token: ${{ secrets.GITHUB_TOKEN }}
83+
# Optional: path to config file
84+
config-path: .github/auto-approve.yml
85+
```
86+
87+
### As a Deployed App
88+
89+
You can deploy this app as a GitHub App on platforms like Vercel:
90+
91+
1. Create a GitHub App in your organization or account
92+
2. Set the required permissions:
93+
- Pull requests: Read & Write
94+
- Checks: Read
95+
- Repository contents: Read
96+
- Repository metadata: Read
97+
3. Subscribe to the webhook events:
98+
- Pull request
99+
- Pull request review
100+
- Check run
101+
4. Deploy to a serverless platform like Vercel:
102+
```bash
103+
# Install Vercel CLI
104+
npm i -g vercel
105+
106+
# Deploy
107+
vercel
108+
```
109+
110+
5. Set the webhook URL to your deployment URL
111+
112+
## Development
113+
114+
```bash
115+
# Install dependencies
116+
pnpm install
117+
118+
# Run in development mode
119+
pnpm run dev
120+
121+
# Build
122+
pnpm run build
123+
124+
# Run tests
125+
pnpm test
126+
127+
# Type checking
128+
pnpm run typecheck
129+
130+
# Linting
131+
pnpm run lint
132+
133+
# Format code
134+
pnpm run format
135+
```
12136

13137
## License
14138

action.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
---
2-
name: GitHub App as a GitHub Action
3-
description: 'GitHub App as a GitHub Action [Template]'
2+
name: Auto-Approve Bot
3+
description: Automatically approve pull requests from configured bots with specific triggers
44
branding:
5-
icon: gift
6-
color: orange
5+
icon: check-circle
6+
color: green
7+
inputs:
8+
github-token:
9+
description: GitHub token with permissions to approve pull requests
10+
required: true
11+
default: ${{ github.token }}
12+
config-path:
13+
description: Path to the configuration file
14+
required: false
15+
default: .github/auto-approve.yml
716
runs:
817
using: node20
918
main: dist/index.js

dist/index.js

Lines changed: 177 additions & 177 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)