Skip to content

Commit 5505897

Browse files
ctauchenclaude
andcommitted
Make llms.txt workflow idempotent for same-day reruns
Use checkout -B and force-with-lease push so the workflow can safely rerun on the same day. Only create a PR if one doesn't already exist for the branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 212c5da commit 5505897

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.github/workflows/generate-llms-txt.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,16 @@ jobs:
5757
BRANCH="chore/update-llms-txt-$(date +%Y-%m-%d)"
5858
git config user.name "github-actions[bot]"
5959
git config user.email "github-actions[bot]@users.noreply.github.com"
60-
git checkout -b "$BRANCH"
60+
git checkout -B "$BRANCH"
6161
git add static/llms.txt \
6262
static/calico/llms.txt static/calico/llms-full.txt \
6363
static/calico-enterprise/llms.txt static/calico-enterprise/llms-full.txt \
6464
static/calico-cloud/llms.txt static/calico-cloud/llms-full.txt
6565
git commit -m "chore: update generated llms.txt files"
66-
git push -u origin "$BRANCH"
67-
gh pr create \
68-
--title "chore: update generated llms.txt files" \
69-
--body "Automated weekly update of llms.txt and llms-full.txt files." \
70-
--base main
66+
git push --force-with-lease -u origin "$BRANCH"
67+
if ! gh pr list --head "$BRANCH" --json number --jq '.[0].number' | grep -q .; then
68+
gh pr create \
69+
--title "chore: update generated llms.txt files" \
70+
--body "Automated weekly update of llms.txt and llms-full.txt files." \
71+
--base main
72+
fi

0 commit comments

Comments
 (0)