From ef40b94b124fa5777f43504daedbeddbe80d7250 Mon Sep 17 00:00:00 2001 From: ruv Date: Sat, 26 Sep 2026 12:58:25 -0400 Subject: [PATCH] ci(submodules): reuse one rolling branch and PR instead of opening a new PR every 6 hours The bot pushed a timestamped branch and opened a fresh PR on every scheduled run, leaving 470+ superseded 'chore: update vendor submodules' PRs open. It now rebuilds a single chore/update-submodules branch from main, force-pushes it, and only opens a PR when none is open, so the existing PR refreshes in place. Co-Authored-By: claude-flow --- .github/workflows/update-submodules.yml | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index f57e19dc4..507ca7268 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -50,18 +50,26 @@ jobs: git diff --submodule=log -- vendor/ || true fi - - name: Create PR with updates + # One rolling branch and at most one open PR. The branch is rebuilt from + # main on every run and force-pushed, so an open PR always shows the + # latest pointers instead of a new PR piling up every six hours. + - name: Create or refresh the update PR if: steps.check.outputs.changed == 'true' run: | - BRANCH="chore/update-submodules-$(date +%Y%m%d-%H%M%S)" - git checkout -b "$BRANCH" + BRANCH="chore/update-submodules" + git checkout -B "$BRANCH" git add vendor/ git commit -m "chore: update vendor submodules to latest upstream" - git push origin "$BRANCH" - gh pr create \ - --title "chore: update vendor submodules" \ - --body "Automated submodule update to the latest upstream commit on each submodule's tracked branch (see \`.gitmodules\`). Review the pointer diff before merging." \ - --base main \ - --head "$BRANCH" + git push --force origin "$BRANCH" + OPEN=$(gh pr list --base main --head "$BRANCH" --state open --json number --jq '.[0].number') + if [ -n "$OPEN" ]; then + echo "Refreshed existing PR #$OPEN" + else + gh pr create \ + --title "chore: update vendor submodules" \ + --body "Automated submodule update to the latest upstream commit on each submodule's tracked branch (see \`.gitmodules\`). This PR is refreshed in place on every scheduled run. Review the pointer diff before merging." \ + --base main \ + --head "$BRANCH" + fi env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}