Skip to content

Commit

Permalink
Real Diff Link Checker (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
uvidyadharan authored Sep 23, 2024
1 parent 97d59be commit 4fbd108
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/link-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
run: pip install -r docs/requirements.txt

- name: link-check
run: make -C docs/ linkcheck SPHINXOPTS="-W --keep-going -n -q"
run: make -C docs/ linkcheckdiff SPHINXOPTS="-W --keep-going -n -q"

- name: Arhive Log
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: LINKCHECK--1
path: docs/build/linkcheck/output.txt
path: docs/build/linkcheckdiff/output.json
retention-days: 7
29 changes: 3 additions & 26 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ jobs:
if unzip -t linkcheck.zip >/dev/null 2>&1; then
unzip -q linkcheck.zip -d linkcheck_contents
echo "Successfully downloaded and unzipped previous LINKCHECK artifact"
mv linkcheck_contents/output.json docs/main-output.json
else
echo "Downloaded file is not a valid zip. Skipping unzip."
rm linkcheck.zip
Expand All @@ -141,38 +142,14 @@ jobs:
- name: link-check
run: |
make -C docs/ linkcheck SPHINXOPTS="-W --keep-going -n -q" || true
- name: Compare outputs
run: |
echo "Archived Errors"
cat linkcheck_contents/output.txt
echo "PR Errors"
cat docs/build/linkcheck/output.txt
if [ -f linkcheck_contents/output.txt ]; then
sort linkcheck_contents/output.txt > old_sorted.txt
sort docs/build/linkcheck/output.txt > new_sorted.txt
new_errors=$(comm -13 old_sorted.txt new_sorted.txt)
if [ -n "$new_errors" ]; then
echo "New errors found:"
echo "$new_errors"
exit 1
else
echo "No new errors found."
fi
else
echo "No previous output.txt found. Treating all current errors as new."
cat docs/build/linkcheck/output.txt
[ -s docs/build/linkcheck/output.txt ] && exit 1 || exit 0
fi
make -C docs/ linkcheckdiff SPHINXOPTS="-W --keep-going -n -q"
- name: Archive Log
if: always()
uses: actions/upload-artifact@v4
with:
name: LINKCHECK-PR-${{ github.event.number }}-${{ github.run_attempt }}
path: docs/build/linkcheck/output.txt
path: docs/build/linkcheckdiff/output.json
retention-days: 7

image-check:
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ sphinx-sitemap==2.3.0
python-git-info==0.8.3
sphinxcontrib-mermaid==0.9.2
sphinxext-rediraffe==0.2.7
git+https://github.com/FIRST-Tech-Challenge/ftcdocs-helper@main#subdirectory=linkcheckdiff
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'sphinxcontrib.cookiebanner',
'sphinxcontrib.mermaid',
"sphinxext.rediraffe",
"ftcdocs_linkcheckdiff",
]

autosectionlabel_prefix_document = True
Expand Down

0 comments on commit 4fbd108

Please sign in to comment.