Skip to content

Commit 49bc19d

Browse files
Auto-approve buildpack update PRs (#979)
1 parent 5a340b4 commit 49bc19d

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Auto-approve buildpack update PRs
2+
3+
# Uses `pull_request` (not `pull_request_target`), so fork-source PRs run with
4+
# secrets stripped and a read-only `GITHUB_TOKEN`. `synchronize` is omitted,
5+
# so approval only fires on the initial PR open.
6+
on:
7+
pull_request:
8+
types:
9+
- opened
10+
# Skip queueing the workflow at all for PRs that don't touch
11+
# `builder-*/builder.toml`. The `if:` gate below would also reject
12+
# them, but a `paths:` filter prevents the run from being created.
13+
paths:
14+
- 'builder-*/builder.toml'
15+
16+
permissions:
17+
pull-requests: write
18+
19+
jobs:
20+
auto-approve:
21+
if: >-
22+
github.event.pull_request.head.repo.full_name == github.repository &&
23+
github.event.pull_request.user.login == 'heroku-linguist[bot]' &&
24+
startsWith(github.event.pull_request.head.ref, 'update/heroku/buildpacks-')
25+
# IP-allowlisted runner used because the heroku org's IP allow list
26+
# rejects API calls from GitHub-hosted runners.
27+
runs-on: pub-hk-ubuntu-24.04-ip
28+
steps:
29+
# Approves as `github-actions[bot]` rather than the Linguist user,
30+
# since a user can't approve their own PR.
31+
- name: Approve PR
32+
env:
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
PR_NUMBER: ${{ github.event.pull_request.number }}
35+
run: gh pr review --approve "$PR_NUMBER" --repo "$GITHUB_REPOSITORY"

0 commit comments

Comments
 (0)