From 44d96c3d4bba0e06fe75d11df5825188b30ddc53 Mon Sep 17 00:00:00 2001 From: Kristjan Kruus Date: Tue, 24 Mar 2026 14:03:27 +0200 Subject: [PATCH] chore: update sync-fork to create PR from main to my-custom-setup --- .github/workflows/sync-fork.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-fork.yml b/.github/workflows/sync-fork.yml index 65318f296..6493ba117 100644 --- a/.github/workflows/sync-fork.yml +++ b/.github/workflows/sync-fork.yml @@ -13,7 +13,31 @@ jobs: with: 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 env: 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 }}