|
| 1 | +name: PR84 Remove Stale Documentation Links |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [agent/readme-layout-cleanup] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
| 10 | +jobs: |
| 11 | + remove-stale-links: |
| 12 | + if: github.event.head_commit.message != 'docs: remove stale PyTorch guide references' |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + ref: agent/readme-layout-cleanup |
| 18 | + - name: Remove references to absent historical artifacts |
| 19 | + shell: bash |
| 20 | + run: | |
| 21 | + python3 - <<'PY' |
| 22 | + from pathlib import Path |
| 23 | +
|
| 24 | + names = ( |
| 25 | + "torch_vs_cupy_comprehensive_report.md", |
| 26 | + "knockoff_fdr_2026-04-18_09-15-29.md", |
| 27 | + "torch_vs_cupy_20260418_092648.md", |
| 28 | + ) |
| 29 | + for filename in ( |
| 30 | + "docs/en/guides/pytorch-backend.md", |
| 31 | + "docs/cn/guides/pytorch-backend.md", |
| 32 | + ): |
| 33 | + path = Path(filename) |
| 34 | + lines = path.read_text(encoding="utf-8").splitlines() |
| 35 | + kept = [line for line in lines if not any(name in line for name in names)] |
| 36 | + with path.open("w", encoding="utf-8", newline="\n") as handle: |
| 37 | + handle.write("\n".join(kept) + "\n") |
| 38 | + PY |
| 39 | + - name: Commit reference cleanup |
| 40 | + shell: bash |
| 41 | + run: | |
| 42 | + if git diff --quiet -- docs/en/guides/pytorch-backend.md docs/cn/guides/pytorch-backend.md; then |
| 43 | + echo "No stale references remain." |
| 44 | + exit 0 |
| 45 | + fi |
| 46 | + git config user.name "github-actions[bot]" |
| 47 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 48 | + git add docs/en/guides/pytorch-backend.md docs/cn/guides/pytorch-backend.md |
| 49 | + git commit -m "docs: remove stale PyTorch guide references" |
| 50 | + git push origin HEAD:agent/readme-layout-cleanup |
0 commit comments