Skip to content

Commit e7f8196

Browse files
authored
chore(ci): add release automerge workflow (#111)
1 parent 92497bd commit e7f8196

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release Automerge
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 * * 1'
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
merge:
14+
name: Merge Release PR
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Find and merge autorelease PR
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
REPO: ${{ github.repository }}
21+
run: |
22+
PR=$(gh pr list --repo "$REPO" --label "autorelease: pending" --state open --json number,url --jq '.[0]')
23+
if [ -z "$PR" ] || [ "$PR" = "null" ]; then
24+
echo "No autorelease PR found, nothing to do."
25+
exit 0
26+
fi
27+
PR_NUMBER=$(echo "$PR" | jq -r '.number')
28+
PR_URL=$(echo "$PR" | jq -r '.url')
29+
echo "Merging PR #$PR_NUMBER: $PR_URL"
30+
gh pr merge "$PR_NUMBER" --repo "$REPO" --merge

0 commit comments

Comments
 (0)