Skip to content

Commit d13db48

Browse files
Document and automate content index repairs (#7404)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 60dc1e7 commit d13db48

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

‎.github/workflows/content-index.yml‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,20 @@ jobs:
3131
python-version: "3.11"
3232
- name: Run content index tests
3333
run: python -m unittest tools.content_index.test_content_index
34-
- name: Check generated index
35-
run: python tools/content_index/content_index.py check
34+
- name: Generate content index
35+
run: python tools/content_index/content_index.py build
36+
- name: Compare generated index
37+
id: generated-index
38+
continue-on-error: true
39+
run: git diff --exit-code -- .github/content-index.jsonl
40+
- name: Copy stale index artifact
41+
if: steps.generated-index.outcome == 'failure'
42+
run: cp .github/content-index.jsonl "${RUNNER_TEMP}/content-index.jsonl"
43+
- uses: actions/upload-artifact@v4
44+
if: steps.generated-index.outcome == 'failure'
45+
with:
46+
name: generated-content-index
47+
path: ${{ runner.temp }}/content-index.jsonl
3648
- name: Create duplicate candidate report
3749
run: |
3850
python tools/content_index/content_index.py audit \
@@ -42,3 +54,8 @@ jobs:
4254
with:
4355
name: content-duplicate-audit
4456
path: content-duplicate-audit.md
57+
- name: Fail for stale content index
58+
if: steps.generated-index.outcome == 'failure'
59+
run: |
60+
echo "::error::.github/content-index.jsonl is stale. Download the generated-content-index artifact or run the generator locally."
61+
exit 1

‎AGENTS.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ After you change conceptual Markdown, regenerate the catalog and commit the resu
4545
python tools/content_index/content_index.py build
4646
```
4747

48+
### Repair a stale content index in an existing PR
49+
50+
If the **Conceptual content index** check fails because `.github/content-index.jsonl` is stale, update the existing PR branch. The JSONL file is generated, but committing the generator's output is required and permitted. Do not edit the JSONL manually.
51+
52+
From the repository root, run:
53+
54+
```console
55+
python tools/content_index/content_index.py build
56+
python tools/content_index/content_index.py check
57+
python -m unittest tools.content_index.test_content_index
58+
```
59+
60+
Commit the regenerated `.github/content-index.jsonl` file to the PR branch. Remove `tools/content_index/__pycache__/` if Python creates it, and don't stage unrelated working-tree changes.
61+
62+
When the check finds a stale index, the workflow uploads the corrected file as the `generated-content-index` artifact on the failed workflow run. You can download that artifact and commit its `content-index.jsonl` file as `.github/content-index.jsonl`, or use the local commands above. The workflow doesn't push the correction automatically because commits made with its GitHub token wouldn't trigger the other required PR checks.
63+
4864
Use `python tools/content_index/content_index.py audit` to produce likely duplicate pairs for human review. Similarity is not proof of duplication; account for audience, product, language, version, and lifecycle differences before consolidating content.
4965

5066
## Branch naming

0 commit comments

Comments
 (0)