Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit f7cba6f

Browse files
committed
ci: update sync process for stable branch to main
This commit modifies the GitHub Actions workflow to create a pull request for syncing changes from the stable branch to the main branch. It checks for existing open pull requests and only creates a new one if necessary, improving the automation and efficiency of the release process.
1 parent 94afd39 commit f7cba6f

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

.github/workflows/release-package.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,22 @@ jobs:
5252
run: |
5353
pnpm dlx semantic-release
5454
55-
- name: Sync stable back to main
55+
- name: Create sync PR to main
5656
if: github.ref == 'refs/heads/stable'
5757
env:
5858
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
59+
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
5960
run: |
60-
git config user.name "github-actions[bot]"
61-
git config user.email "github-actions[bot]@users.noreply.github.com"
62-
git fetch origin main stable
63-
git checkout main
64-
git merge origin/stable -m "chore: sync stable release to main"
65-
git push origin main
61+
pr_number=$(gh pr list --base main --head stable --state open --json number --jq '.[0].number')
62+
if [ -z "$pr_number" ]; then
63+
git fetch origin main
64+
if git diff --quiet origin/main...HEAD; then
65+
echo "Main is already up to date with stable; skipping PR."
66+
exit 0
67+
fi
68+
pr_number=$(gh pr create --base main --head stable --title "chore: sync stable release to main" --body "Automated PR to merge the latest stable changes back into main." --json number --jq '.number')
69+
echo "Created PR #$pr_number to sync stable into main."
70+
else
71+
echo "PR #$pr_number already open to sync stable into main."
72+
fi
73+
gh pr merge "$pr_number" --merge --auto || echo "Auto-merge setup skipped (conditions not met)."

0 commit comments

Comments
 (0)