@@ -10,39 +10,37 @@ jobs:
1010 runs-on : ubuntu-22.04
1111
1212 steps :
13+ # Step 1: Checkout the repository code
1314 - name : Checkout code
1415 uses : actions/checkout@v3
1516
17+ # Step 2: Set up Node.js environment
1618 - name : Set up Node.js
1719 uses : actions/setup-node@v3
1820 with :
1921 node-version : ' 18'
2022
23+ # Step 3: Install the markdown-link-check tool globally
2124 - name : Install markdown-link-check
2225 run : npm install -g markdown-link-check
2326
27+ # Step 4: Check README links and log the results
2428 - name : Check README links
2529 id : check-links
2630 run : |
31+ # Run markdown-link-check and store the results
2732 markdown-link-check --verbose README.md > link-check-results.txt || true
33+
34+ # Output the results for debugging
2835 echo "::group::Link Check Results"
2936 cat link-check-results.txt
3037 echo "::endgroup::"
3138
39+ # Step 5: Analyze the results and annotate them
3240 - name : Annotate Results
3341 run : |
34- # Extract broken links
42+ # Extract broken links and exclude any links from ./Assets
3543 broken_links=$(grep -B 1 "✖" link-check-results.txt | grep -v "./Assets" || true)
3644
37- if [ -n "$broken_links" ]; then
38- echo "::error title=Broken Links Found::The following links are broken:"
39- echo "$broken_links" | sed 's/%/%25/g; s/\n/%0A/g; s/\r/%0D/g'
40-
41- # Print broken links in console for debugging
42- echo "Broken Links Details:"
43- echo "$broken_links"
44-
45- exit 1
46- else
47- echo "::notice title=All Links Valid::All links in the README are valid."
48- fi
45+ # Count total links and broken links
46+ total_links=$(grep -oE "
0 commit comments