Skip to content

Commit

Permalink
Update docs_link_check.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Khushalsarode authored Oct 29, 2024
1 parent c5b7e18 commit 616e3e5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/docs_link_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,30 @@ jobs:
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"
python-version: '3.x'


- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
echo "Dependencies installed."
- name: Run Sphinx linkcheck
run: |
cd docs
sphinx-build -b linkcheck source _build/linkcheck > /dev/null 2>&1 || true # Suppress full output
sphinx-build -b linkcheck source _build/linkcheck > /dev/null 2>&1 || true
grep "broken" _build/linkcheck/output.txt > broken_links.txt
grep "Not Found for url" _build/linkcheck/output.txt > not_found_links.txt
grep "broken" _build/linkcheck/output.txt > broken_links.txt # Extract broken links
grep "Not Found for url" _build/linkcheck/output.txt > not_found_links.txt # Extract not found links
# -s flag checks if the file is not empty.
if [ -s broken_links.txt ]; then
echo "============"
echo "Broken Links"
echo "Broken links"
echo "============"
cat broken_links.txt
fi
if [ -s not_found_links.txt ]; then
echo "==============="
Expand All @@ -48,7 +49,6 @@ jobs:
cat not_found_links.txt
fi
# Exit with error if any broken or not found links exist
if [ -s broken_links.txt ] || [ -s not_found_links.txt ]; then
echo "Broken links found."
exit 1
Expand Down

0 comments on commit 616e3e5

Please sign in to comment.