Skip to content

Commit d18b599

Browse files
aditya520claude
andcommitted
fix(dev-hub): fix workflow sed extraction and skill-only gate
Fix two bugs in update-llms-txt workflow: 1. sed extraction was deleting the entire `const CONTENT` marker line, silently dropping the first line of content (frontmatter `---` in SKILL.md, `# Heading` in product files). Now strips only the prefix. 2. Pipeline steps were gated on `affected_products != ''`, skipping SKILL.md review when doc changes don't map to a product route. Now also runs when `include_skill == 'true'`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1bfb5bf commit d18b599

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
echo "No significant documentation changes detected. Skipping."
155155
156156
- name: Read content from affected product files
157-
if: steps.changed-files.outputs.significant == 'true' && steps.changed-files.outputs.affected_products != ''
157+
if: steps.changed-files.outputs.significant == 'true' && (steps.changed-files.outputs.affected_products != '' || steps.changed-files.outputs.include_skill == 'true')
158158
id: headers
159159
env:
160160
AFFECTED: ${{ steps.changed-files.outputs.affected_products }}
@@ -169,7 +169,7 @@ jobs:
169169
ROUTE_FILE="$ROUTE_DIR/$product/route.ts"
170170
if [ -f "$ROUTE_FILE" ]; then
171171
# Extract CONTENT content (between opening backtick and closing `; line)
172-
sed -n '/const CONTENT = `/,/^`;/{/const CONTENT = `/d;/^`;/d;p}' "$ROUTE_FILE" > "/tmp/header-${product}.txt"
172+
sed -n '/const CONTENT = `/{s/const CONTENT = `//;:a;/^`;/q;p;n;ba}' "$ROUTE_FILE" > "/tmp/header-${product}.txt"
173173
HEADERS_JSON=$(jq --arg key "$product" --rawfile val "/tmp/header-${product}.txt" '. + {($key): $val}' <<< "$HEADERS_JSON")
174174
fi
175175
done
@@ -178,7 +178,7 @@ jobs:
178178
if [ "$INCLUDE_SKILL" = "true" ]; then
179179
SKILL_FILE="$ROUTE_DIR/SKILL.md/route.ts"
180180
if [ -f "$SKILL_FILE" ]; then
181-
sed -n '/const CONTENT = `/,/^`;/{/const CONTENT = `/d;/^`;/d;p}' "$SKILL_FILE" > "/tmp/header-SKILL.md.txt"
181+
sed -n '/const CONTENT = `/{s/const CONTENT = `//;:a;/^`;/q;p;n;ba}' "$SKILL_FILE" > "/tmp/header-SKILL.md.txt"
182182
HEADERS_JSON=$(jq --arg key "SKILL.md" --rawfile val "/tmp/header-SKILL.md.txt" '. + {($key): $val}' <<< "$HEADERS_JSON")
183183
fi
184184
fi
@@ -187,7 +187,7 @@ jobs:
187187
echo "Extracted headers for: $AFFECTED"
188188
189189
- name: Gather context
190-
if: steps.changed-files.outputs.significant == 'true' && steps.changed-files.outputs.affected_products != ''
190+
if: steps.changed-files.outputs.significant == 'true' && (steps.changed-files.outputs.affected_products != '' || steps.changed-files.outputs.include_skill == 'true')
191191
id: context
192192
env:
193193
CHANGED_FILES_LIST: ${{ steps.changed-files.outputs.files }}
@@ -216,7 +216,7 @@ jobs:
216216
echo "EOF" >> $GITHUB_OUTPUT
217217
218218
- name: Review curated content with GPT-4o
219-
if: steps.changed-files.outputs.significant == 'true' && steps.changed-files.outputs.affected_products != ''
219+
if: steps.changed-files.outputs.significant == 'true' && (steps.changed-files.outputs.affected_products != '' || steps.changed-files.outputs.include_skill == 'true')
220220
env:
221221
OPENAI_API_KEY: ${{ secrets.PYTH_NETWORK_PYTH_CROSSCHAIN_OPENAI_API_KEY }}
222222
DOC_CHANGES: ${{ steps.context.outputs.changes }}
@@ -321,7 +321,7 @@ jobs:
321321
fi
322322
323323
- name: Update product route files
324-
if: steps.changed-files.outputs.significant == 'true' && steps.changed-files.outputs.affected_products != '' && env.no_update != 'true'
324+
if: steps.changed-files.outputs.significant == 'true' && (steps.changed-files.outputs.affected_products != '' || steps.changed-files.outputs.include_skill == 'true') && env.no_update != 'true'
325325
run: |
326326
ROUTE_DIR="apps/developer-hub/src/app"
327327
DECISIONS=$(cat /tmp/update-decisions.json)
@@ -376,7 +376,7 @@ jobs:
376376
done
377377
378378
- name: Format updated files
379-
if: steps.changed-files.outputs.significant == 'true' && steps.changed-files.outputs.affected_products != '' && env.no_update != 'true'
379+
if: steps.changed-files.outputs.significant == 'true' && (steps.changed-files.outputs.affected_products != '' || steps.changed-files.outputs.include_skill == 'true') && env.no_update != 'true'
380380
env:
381381
AFFECTED: ${{ steps.changed-files.outputs.affected_products }}
382382
INCLUDE_SKILL: ${{ steps.changed-files.outputs.include_skill }}
@@ -391,13 +391,13 @@ jobs:
391391
fi
392392
393393
- name: Re-run token counter
394-
if: steps.changed-files.outputs.significant == 'true' && steps.changed-files.outputs.affected_products != '' && env.no_update != 'true'
394+
if: steps.changed-files.outputs.significant == 'true' && (steps.changed-files.outputs.affected_products != '' || steps.changed-files.outputs.include_skill == 'true') && env.no_update != 'true'
395395
run: |
396396
cd apps/developer-hub
397397
npx tsx scripts/count-llm-tokens.ts
398398
399399
- name: Commit and push changes
400-
if: steps.changed-files.outputs.significant == 'true' && steps.changed-files.outputs.affected_products != '' && env.no_update != 'true'
400+
if: steps.changed-files.outputs.significant == 'true' && (steps.changed-files.outputs.affected_products != '' || steps.changed-files.outputs.include_skill == 'true') && env.no_update != 'true'
401401
env:
402402
AFFECTED: ${{ steps.changed-files.outputs.affected_products }}
403403
INCLUDE_SKILL: ${{ steps.changed-files.outputs.include_skill }}

0 commit comments

Comments
 (0)