Skip to content

Commit 63886e1

Browse files
Merge pull request #1433 from sendbird/chore/auto-approve-release-pr
[chore]: auto-approve release PRs via automation
2 parents 6bf1404 + 219d61b commit 63886e1

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Approve by automation
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
approve-release-pr:
12+
if: github.base_ref == 'main' && startsWith(github.head_ref, 'release/v')
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Approve release pull request
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
HEAD_REF: ${{ github.head_ref }}
19+
PR_NUMBER: ${{ github.event.pull_request.number }}
20+
REPO: ${{ github.repository }}
21+
run: |
22+
if ! printf '%s' "$HEAD_REF" | grep -qE '^release/v[0-9]+\.[0-9]+\.[0-9]+$'; then
23+
echo "Not an exact release/vX.Y.Z branch ('$HEAD_REF'); skipping auto-approval."
24+
exit 0
25+
fi
26+
gh pr review "$PR_NUMBER" \
27+
--approve \
28+
--body "Auto-approved: release branch PR (release/vX.Y.Z). Release is gated by the Jira EM approval." \
29+
--repo "$REPO"

0 commit comments

Comments
 (0)