Files
RuView/.github/workflows/update-submodules.yml
ruv ef40b94b12 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 <ruv@ruv.net>
2026-09-26 12:58:41 -04:00

76 lines
3.1 KiB
YAML

name: Update vendor submodules
on:
schedule:
- cron: '0 */6 * * *' # Every 6 hours
workflow_dispatch: # Manual trigger
permissions:
contents: write
pull-requests: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
# Identity must be set BEFORE any operation that can create a commit.
# `git submodule update --remote --merge` used to fail here with
# "Committer identity unknown" because the merge inside vendor/ruvector
# needs an author when the pinned commit isn't a fast-forward of upstream.
- name: Configure git identity
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Use a plain `--remote` checkout (detached HEAD at each submodule's
# configured `branch` tip from .gitmodules) rather than `--merge`. We only
# want to bump the superproject's gitlink to the latest upstream commit;
# there's no reason to create merge commits inside the vendored repos, and
# `--merge` breaks whenever the current pin has diverged from that branch.
- name: Update submodules to latest tracked branch
run: |
git submodule sync --recursive
git submodule update --remote --recursive
- name: Check for changes
id: check
run: |
if git diff --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "--- submodule pointer changes ---"
git submodule status --recursive || true
git diff --submodule=log -- vendor/ || true
fi
# 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"
git checkout -B "$BRANCH"
git add vendor/
git commit -m "chore: update vendor submodules to latest upstream"
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 }}