Files
awesome-docker/.github/workflows/broken_links.yml
Julien Bisconti e5d5594775 feat: update all GitHub Actions workflows from Node.js to Go
Replace Node.js setup, npm install, and node/npm commands with
Go setup, go build, and the new awesome-docker CLI binary in all
four workflow files: pull_request, broken_links, health_report,
and deploy-pages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 23:26:48 +01:00

93 lines
3.0 KiB
Markdown

name: Broken Links Report
on:
schedule:
- cron: "0 2 * * 6"
workflow_dispatch:
jobs:
check-links:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Build
run: go build -o awesome-docker ./cmd/awesome-docker
- name: Run Link Check
id: link_check
run: |
./awesome-docker check > link_check_output.txt 2>&1 || true
if grep -q "broken links" link_check_output.txt; then
echo "has_errors=true" >> "$GITHUB_OUTPUT"
else
echo "has_errors=false" >> "$GITHUB_OUTPUT"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create/Update Issue for Broken Links
if: steps.link_check.outputs.has_errors == 'true'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const output = fs.readFileSync('link_check_output.txt', 'utf8');
const issueBody = `# Broken Links Detected\n\nThe weekly link check found broken or inaccessible links.\n\n\`\`\`\n${output}\n\`\`\`\n\n## Action Required\n\n- Update the URL if the resource moved\n- Remove the entry if permanently unavailable\n- Add to \`config/exclude.yaml\` if a known false positive\n\n---\n*Auto-generated by broken_links.yml*`;
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'broken-links',
per_page: 1
});
if (issues.data.length > 0) {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issues.data[0].number,
body: issueBody
});
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Broken Links Detected',
body: issueBody,
labels: ['broken-links', 'bug']
});
}
- name: Close Issue if No Errors
if: steps.link_check.outputs.has_errors == 'false'
uses: actions/github-script@v7
with:
script: |
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'broken-links',
per_page: 1
});
if (issues.data.length > 0) {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issues.data[0].number,
state: 'closed',
state_reason: 'completed'
});
}