Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions .github/workflows/url-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,39 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0

- name: Install markdown-link-check
run: npm i -g markdown-link-check@3.14.2

- name: Set options
id: options
- name: Determine files to check
id: files
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "check-modified-files-only=yes" >> $GITHUB_OUTPUT
echo "use-verbose-mode=yes" >> $GITHUB_OUTPUT
git diff --name-only --diff-filter=AM origin/${{ github.base_ref }} -- 5.0/ | grep '\.md$' > /tmp/files_to_check.txt || true
echo "mode=modified" >> $GITHUB_OUTPUT
else
echo "check-modified-files-only=no" >> $GITHUB_OUTPUT
echo "use-verbose-mode=no" >> $GITHUB_OUTPUT
find 5.0 -name '*.md' -not -path './node_modules/*' > /tmp/files_to_check.txt
echo "mode=all" >> $GITHUB_OUTPUT
fi
echo "Checking files (mode: $(cat $GITHUB_OUTPUT | grep mode | cut -d= -f2)):"
cat /tmp/files_to_check.txt

- name: Check URLs
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
check-modified-files-only: ${{ steps.options.outputs.check-modified-files-only }}
config-file: .github/workflows/config/url-checker-config.json
folder-path: '5.0'
use-quiet-mode: yes
use-verbose-mode: ${{ steps.options.outputs.use-verbose-mode }}
run: |
ERROR_FOUND=0
while IFS= read -r file; do
if [ -n "$file" ]; then
markdown-link-check "$file" --config .github/workflows/config/url-checker-config.json -q || ERROR_FOUND=1
fi
done < /tmp/files_to_check.txt

if [ "$ERROR_FOUND" -eq 1 ]; then
echo ""
echo "ERROR: Dead links were found!"
exit 1
else
echo ""
echo "All links are good!"
fi