V2 External Link Audit (Advisory) #122
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: V2 External Link Audit (Advisory) | |
| on: | |
| schedule: | |
| - cron: '0 4 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| v2-external-link-audit: | |
| name: v2-external-link-audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Run V2 external link audit (advisory) | |
| id: link-audit | |
| continue-on-error: true | |
| run: | | |
| node tests/integration/v2-link-audit.js \ | |
| --full \ | |
| --external-policy validate \ | |
| --external-link-types navigational \ | |
| --no-write-links \ | |
| --report /tmp/v2-link-audit-external.md \ | |
| --report-json /tmp/v2-link-audit-external.json | |
| - name: Upload external link audit reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: v2-external-link-audit-report | |
| path: | | |
| /tmp/v2-link-audit-external.md | |
| /tmp/v2-link-audit-external.json | |
| retention-days: 7 | |
| - name: Publish summary | |
| if: always() | |
| run: | | |
| echo "## V2 External Link Audit (Advisory)" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- Workflow mode: advisory" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- Audit step outcome: ${{ steps.link-audit.outcome }}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| if [ -f /tmp/v2-link-audit-external.json ]; then | |
| node -e "const fs=require('fs'); const p='/tmp/v2-link-audit-external.json'; const j=JSON.parse(fs.readFileSync(p,'utf8')); const e=j.aggregate?.external||{}; const out=[]; out.push('- Files analyzed: '+(j.aggregate?.filesAnalyzed ?? 0)); out.push('- Total refs: '+(j.aggregate?.totalRefs ?? 0)); out.push('- External eligible refs: '+(e.eligibleRefCount ?? 0)); out.push('- External unique URLs: '+(e.uniqueUrlCount ?? 0)); out.push('- External unique hosts: '+(e.uniqueHostCount ?? 0)); const classes=e.urlClassCounts||{}; out.push('- URL classes: '+JSON.stringify(classes)); fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, out.join('\n')+'\n');" | |
| else | |
| echo "- JSON report missing; check run logs." >> "$GITHUB_STEP_SUMMARY" | |
| fi |