Skip to content

Commit 7e2a371

Browse files
authored
ci(refresh-catalog): fetch existing branch before force-with-lease (#15)
When attempt 1 of a scheduled run pushes the branch and a later attempt re-runs the job, actions/checkout only fetches main. Without a remote-tracking ref for the catalog/refresh-* branch, git push --force-with-lease aborts with "stale info" and the workflow can never succeed on retry. Explicitly fetch the branch (best-effort, since it may not yet exist on first runs) so the lease has something to compare.
1 parent 19cdc1f commit 7e2a371

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

.github/workflows/refresh-catalog.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
BRANCH="catalog/refresh-$DATE"
4040
git config user.name 'github-actions[bot]'
4141
git config user.email 'github-actions[bot]@users.noreply.github.com'
42+
# Ensure remote-tracking ref exists so --force-with-lease works on retries.
43+
git fetch origin "+refs/heads/$BRANCH:refs/remotes/origin/$BRANCH" || true
4244
git checkout -B "$BRANCH"
4345
git add data/repos.json
4446
git commit -m "chore(catalog): refresh snapshot $DATE"

0 commit comments

Comments
 (0)