Skip to content

Commit f0abf14

Browse files
committed
ci: Add GitHub Actions workflow to automatically create pull requests and merge v2 into main.
1 parent e30bd06 commit f0abf14

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Auto PR and Merge v2 to main
2+
3+
on:
4+
push:
5+
branches:
6+
- v2
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
auto-merge:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Auto PR and Merge
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
run: |
26+
echo "Attempting to create PR from v2 to main..."
27+
# This command creates a PR if there are differences. It fails gracefully if a PR already exists or if there's no diff.
28+
gh pr create --base main --head v2 --title "chore: auto sync v2 to main" --body "Automatically merging v2 into main after changes." || echo "PR creation skipped (already exists or no diff)."
29+
30+
echo "Attempting to merge the PR..."
31+
# This command merges the open PR from v2 to main.
32+
gh pr merge v2 --merge || echo "PR merge skipped (maybe branch protection rules prevented it or no open PR)."

0 commit comments

Comments
 (0)