1919 - name : Check and test all documentation links
2020 id : link-check
2121 run : |
22- echo "# Link Check Results" > /tmp/link-check-results.md
23- echo "" >> /tmp/link-check-results.md
22+ echo "# Link Check Results" > /tmp/gh-aw/agent/ link-check-results.md
23+ echo "" >> /tmp/gh-aw/agent/ link-check-results.md
2424
2525 # Find all markdown files in docs directory and README
2626 echo "Finding all markdown files..."
@@ -33,34 +33,34 @@ steps:
3333 fi
3434
3535 # Extract all links from markdown files
36- echo "## Links Found" >> /tmp/link-check-results.md
37- echo "" >> /tmp/link-check-results.md
36+ echo "## Links Found" >> /tmp/gh-aw/agent/ link-check-results.md
37+ echo "" >> /tmp/gh-aw/agent/ link-check-results.md
3838
3939 # Use grep to find markdown links and HTTP(S) URLs
4040 for file in $MARKDOWN_FILES; do
4141 echo "Checking $file..."
4242 # Extract markdown links [text](url)
43- grep -oP '\[([^\]]+)\]\(([^\)]+)\)' "$file" | grep -oP '\(([^\)]+)\)' | tr -d '()' >> /tmp/all-links.txt 2>/dev/null || true
43+ grep -oP '\[([^\]]+)\]\(([^\)]+)\)' "$file" | grep -oP '\(([^\)]+)\)' | tr -d '()' >> /tmp/gh-aw/agent/ all-links.txt 2>/dev/null || true
4444 # Extract plain HTTP(S) URLs
45- grep -oP 'https?://[^\s<>"]+' "$file" >> /tmp/all-links.txt 2>/dev/null || true
45+ grep -oP 'https?://[^\s<>"]+' "$file" >> /tmp/gh-aw/agent/ all-links.txt 2>/dev/null || true
4646 done
4747
4848 # Remove duplicates and sort
49- if [ -f /tmp/all-links.txt ]; then
50- sort -u /tmp/all-links.txt > /tmp/unique-links.txt
51- LINK_COUNT=$(wc -l < /tmp/unique-links.txt)
52- echo "Found $LINK_COUNT unique links" >> /tmp/link-check-results.md
53- echo "" >> /tmp/link-check-results.md
49+ if [ -f /tmp/gh-aw/agent/ all-links.txt ]; then
50+ sort -u /tmp/gh-aw/agent/ all-links.txt > /tmp/gh-aw/agent /unique-links.txt
51+ LINK_COUNT=$(wc -l < /tmp/gh-aw/agent/ unique-links.txt)
52+ echo "Found $LINK_COUNT unique links" >> /tmp/gh-aw/agent/ link-check-results.md
53+ echo "" >> /tmp/gh-aw/agent/ link-check-results.md
5454 else
55- echo "No links found" >> /tmp/link-check-results.md
55+ echo "No links found" >> /tmp/gh-aw/agent/ link-check-results.md
5656 echo "no_links=true" >> $GITHUB_OUTPUT
5757 exit 0
5858 fi
5959
6060 # Test each link
61- echo "## Link Test Results" >> /tmp/link-check-results.md
62- echo "" >> /tmp/link-check-results.md
63- echo "Testing links..." >> /tmp/link-check-results.md
61+ echo "## Link Test Results" >> /tmp/gh-aw/agent/ link-check-results.md
62+ echo "" >> /tmp/gh-aw/agent/ link-check-results.md
63+ echo "Testing links..." >> /tmp/gh-aw/agent/ link-check-results.md
6464
6565 BROKEN_COUNT=0
6666 WORKING_COUNT=0
@@ -76,21 +76,21 @@ steps:
7676
7777 if [[ "$HTTP_CODE" =~ ^2 ]] || [[ "$HTTP_CODE" =~ ^3 ]]; then
7878 WORKING_COUNT=$((WORKING_COUNT + 1))
79- echo "✅ $url (HTTP $HTTP_CODE)" >> /tmp/link-check-results.md
79+ echo "✅ $url (HTTP $HTTP_CODE)" >> /tmp/gh-aw/agent/ link-check-results.md
8080 else
8181 BROKEN_COUNT=$((BROKEN_COUNT + 1))
82- echo "❌ $url (HTTP $HTTP_CODE)" >> /tmp/link-check-results.md
82+ echo "❌ $url (HTTP $HTTP_CODE)" >> /tmp/gh-aw/agent/ link-check-results.md
8383 fi
84- done < /tmp/unique-links.txt
84+ done < /tmp/gh-aw/agent/ unique-links.txt
8585
86- echo "" >> /tmp/link-check-results.md
87- echo "**Summary:** $WORKING_COUNT working, $BROKEN_COUNT broken" >> /tmp/link-check-results.md
86+ echo "" >> /tmp/gh-aw/agent/ link-check-results.md
87+ echo "**Summary:** $WORKING_COUNT working, $BROKEN_COUNT broken" >> /tmp/gh-aw/agent/ link-check-results.md
8888
8989 # Output results
9090 echo "broken_count=$BROKEN_COUNT" >> $GITHUB_OUTPUT
9191 echo "working_count=$WORKING_COUNT" >> $GITHUB_OUTPUT
9292
93- cat /tmp/link-check-results.md
93+ cat /tmp/gh-aw/agent/ link-check-results.md
9494 shell : bash
9595
9696tools :
@@ -118,14 +118,14 @@ Your workflow has already collected and tested all links in the previous step. U
118118
119119## Step 1: Review Link Check Results
120120
121- The link check step has already run and created a report at ` /tmp/link-check-results.md ` . Read this file to see:
121+ The link check step has already run and created a report at ` /tmp/gh-aw/agent/ link-check-results.md ` . Read this file to see:
122122- All links found in the documentation
123123- Which links are working (✅) and which are broken (❌)
124124- HTTP status codes for each link
125125
126126Use bash to read the file:
127127``` bash
128- cat /tmp/link-check-results.md
128+ cat /tmp/gh-aw/agent/ link-check-results.md
129129```
130130
131131## Step 2: Load Cache Memory
@@ -228,4 +228,4 @@ Based on your work:
228228
229229- Repository: ` ${{ github.repository }} `
230230- Run daily on weekdays to catch broken links early
231- - Link test results are available at ` /tmp/link-check-results.md `
231+ - Link test results are available at ` /tmp/gh-aw/agent/ link-check-results.md `
0 commit comments