chore: update sync-fork to create PR from main to my-custom-setup
This commit is contained in:
parent
61400eb783
commit
44d96c3d4b
1 changed files with 25 additions and 1 deletions
26
.github/workflows/sync-fork.yml
vendored
26
.github/workflows/sync-fork.yml
vendored
|
|
@ -13,7 +13,31 @@ jobs:
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Sync fork with upstream
|
- name: Sync main with upstream
|
||||||
run: gh repo sync ${{ github.repository }} --source sipeed/picoclaw --branch main
|
run: gh repo sync ${{ github.repository }} --source sipeed/picoclaw --branch main
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create PR from main to my-custom-setup
|
||||||
|
run: |
|
||||||
|
# Check if there's already an open PR from main to my-custom-setup
|
||||||
|
EXISTING=$(gh pr list --repo ${{ github.repository }} --base my-custom-setup --head main --state open --json number --jq '.[0].number')
|
||||||
|
if [ -n "$EXISTING" ]; then
|
||||||
|
echo "PR #$EXISTING already open — skipping."
|
||||||
|
else
|
||||||
|
# Check if main has commits not in my-custom-setup
|
||||||
|
BEHIND=$(gh api repos/${{ github.repository }}/compare/my-custom-setup...main --jq '.ahead_by')
|
||||||
|
if [ "$BEHIND" -gt 0 ] 2>/dev/null; then
|
||||||
|
gh pr create \
|
||||||
|
--repo ${{ github.repository }} \
|
||||||
|
--base my-custom-setup \
|
||||||
|
--head main \
|
||||||
|
--title "Sync upstream changes into my-custom-setup" \
|
||||||
|
--body "Automated PR to merge latest upstream changes from \`main\` into \`my-custom-setup\`."
|
||||||
|
echo "PR created."
|
||||||
|
else
|
||||||
|
echo "No new upstream commits — skipping PR."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue