Add ci subcommands and simplify scheduled workflows
This commit is contained in:
27
.github/workflows/broken_links.yml
vendored
27
.github/workflows/broken_links.yml
vendored
@@ -5,9 +5,14 @@ on:
|
||||
- cron: "0 2 * * 6"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: broken-links-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
check-links:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
@@ -24,22 +29,7 @@ jobs:
|
||||
|
||||
- name: Run Link Check
|
||||
id: link_check
|
||||
run: |
|
||||
set +e
|
||||
./awesome-docker check > link_check_output.txt 2>&1
|
||||
exit_code=$?
|
||||
set -e
|
||||
|
||||
has_errors=false
|
||||
if [ "$exit_code" -ne 0 ]; then
|
||||
has_errors=true
|
||||
fi
|
||||
if grep -qi "broken links" link_check_output.txt; then
|
||||
has_errors=true
|
||||
fi
|
||||
|
||||
echo "has_errors=$has_errors" >> "$GITHUB_OUTPUT"
|
||||
echo "check_exit_code=$exit_code" >> "$GITHUB_OUTPUT"
|
||||
run: ./awesome-docker ci broken-links --issue-file broken_links_issue.md --github-output "$GITHUB_OUTPUT"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -49,10 +39,7 @@ jobs:
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const output = fs.readFileSync('link_check_output.txt', 'utf8');
|
||||
const exitCode = '${{ steps.link_check.outputs.check_exit_code }}';
|
||||
|
||||
const issueBody = `# Broken Links Detected\n\nThe weekly link check found broken links or the checker failed to execute cleanly.\n\nChecker exit code: ${exitCode}\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- Investigate checker failures when exit code is non-zero\n\n---\n*Auto-generated by broken_links.yml*`;
|
||||
const issueBody = fs.readFileSync('broken_links_issue.md', 'utf8');
|
||||
|
||||
const issues = await github.rest.issues.listForRepo({
|
||||
owner: context.repo.owner,
|
||||
|
||||
24
.github/workflows/health_report.yml
vendored
24
.github/workflows/health_report.yml
vendored
@@ -5,9 +5,14 @@ on:
|
||||
- cron: "0 9 * * 1"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: health-report-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
health-check:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
@@ -22,22 +27,12 @@ jobs:
|
||||
- name: Build
|
||||
run: go build -o awesome-docker ./cmd/awesome-docker
|
||||
|
||||
- name: Run Health Scoring
|
||||
run: ./awesome-docker health
|
||||
continue-on-error: true
|
||||
- name: Run Health + Report
|
||||
id: report
|
||||
run: ./awesome-docker ci health-report --issue-file health_report.txt --github-output "$GITHUB_OUTPUT"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Generate Report
|
||||
id: report
|
||||
run: |
|
||||
./awesome-docker report > health_report.txt 2>&1 || true
|
||||
if [ -s health_report.txt ]; then
|
||||
echo "has_report=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "has_report=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Create/Update Issue with Health Report
|
||||
if: steps.report.outputs.has_report == 'true'
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # ratchet:actions/github-script@v8
|
||||
@@ -45,8 +40,7 @@ jobs:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const report = fs.readFileSync('health_report.txt', 'utf8');
|
||||
|
||||
const issueBody = report + '\n\n---\n*Auto-generated weekly by health_report.yml*';
|
||||
const issueBody = report;
|
||||
|
||||
const issues = await github.rest.issues.listForRepo({
|
||||
owner: context.repo.owner,
|
||||
|
||||
Reference in New Issue
Block a user