99 - ' data/llms-txt-config.yml'
1010 - ' src/workflows/generate-llms-txt.ts'
1111 schedule :
12- - cron : ' 20 16 * * 1-5 ' # Weekdays at ~9:20am Pacific
12+ - cron : ' 20 16 * * 1' # Run every Monday at 16:20 UTC / 8:20 PST
1313
1414permissions :
1515 contents : read
7575 REPO="github/github"
7676
7777 echo "Checking if branch '$BRANCH' exists..."
78- BRANCH_SHA=$(gh api "repos/$REPO/git/ref/heads/$BRANCH" --jq '.object.sha' 2>/dev/null || true)
79- if [ -n "$BRANCH_SHA" ]; then
78+ if BRANCH_SHA=$(gh api "repos/$REPO/git/ref/heads/$BRANCH" --jq '.object.sha' 2>/dev/null); then
8079 echo "Branch exists at $BRANCH_SHA"
8180 else
8281 echo "Branch does not exist, creating from default branch..."
@@ -99,11 +98,11 @@ jobs:
9998 CONTENT=$(base64 -w 0 /tmp/llms.txt)
10099
101100 echo "Checking for existing file SHA on branch..."
102- EXISTING_SHA=$(gh api "repos/$REPO/contents/public/llms.txt?ref=$BRANCH" \
103- --jq '.sha' 2>/dev/null || true)
104- if [ -n "$EXISTING_SHA" ]; then
101+ if EXISTING_SHA=$(gh api "repos/$REPO/contents/public/llms.txt?ref=$BRANCH" \
102+ --jq '.sha' 2>/dev/null); then
105103 echo "Existing file SHA: $EXISTING_SHA"
106104 else
105+ EXISTING_SHA=""
107106 echo "No existing file on branch (new file)"
108107 fi
109108
@@ -128,9 +127,8 @@ jobs:
128127 REPO="github/github"
129128
130129 echo "Checking for existing PR from '$BRANCH'..."
131- EXISTING_PR=$(gh pr list --repo "$REPO" --head "$BRANCH" \
132- --json number --jq '.[0].number' 2>/dev/null || true)
133- if [ -n "$EXISTING_PR" ]; then
130+ if EXISTING_PR=$(gh pr list --repo "$REPO" --head "$BRANCH" \
131+ --json number --jq '.[0].number' 2>/dev/null) && [ -n "$EXISTING_PR" ]; then
134132 echo "PR #$EXISTING_PR already exists, updated with new commit"
135133 exit 0
136134 fi
0 commit comments