Skip to content

fix: fix 17 broken links — truncated slugs, vt100.net, iTerm2 wiki #47

fix: fix 17 broken links — truncated slugs, vt100.net, iTerm2 wiki

fix: fix 17 broken links — truncated slugs, vt100.net, iTerm2 wiki #47

Workflow file for this run

# Content Validation
#
# Runs `bun scripts/validate.ts` weekly and on push to main.
# - Errors (exit code 1): workflow fails
# - Warnings: opens/updates a rolling GitHub issue with label "content-refresh"
#
# The "content-refresh" label should be created in the repo with:
# description: "Automated content validation warnings from weekly CI"
# color: "fbca04" (yellow)
name: Content Validation
on:
schedule:
- cron: "0 9 * * 1" # Every Monday 9am UTC
push:
branches: [main]
workflow_dispatch: # Manual trigger
permissions:
issues: write
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- name: Run validation
id: validate
run: |
bun scripts/validate.ts 2>&1 | tee /tmp/validate-output.txt
echo "output<<EOF" >> $GITHUB_OUTPUT
cat /tmp/validate-output.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
continue-on-error: true
- name: Build site
run: bun run build
- name: Check for broken internal links
run: bun scripts/check-404s.ts
- name: Create or update issue
if: steps.validate.outcome == 'failure' || contains(steps.validate.outputs.output, 'WARN')
uses: actions/github-script@v7
with:
script: |
const title = 'Content refresh: terminfo.dev';
const output = process.env.VALIDATE_OUTPUT || '(no output captured)';
const body = [
'## Weekly Validation Report',
'',
`Run: ${new Date().toISOString()}`,
`Trigger: \`${context.eventName}\``,
'',
'```',
output,
'```',
'',
'---',
'*Auto-generated by [validate.yml](.github/workflows/validate.yml)*',
].join('\n');
const { owner, repo } = context.repo;
// Find existing open issue with the content-refresh label
const issues = await github.rest.issues.listForRepo({
owner,
repo,
state: 'open',
labels: 'content-refresh',
});
const existing = issues.data.find(i => i.title === title);
if (existing) {
await github.rest.issues.update({
owner,
repo,
issue_number: existing.number,
body,
});
core.info(`Updated issue #${existing.number}`);
} else {
const created = await github.rest.issues.create({
owner,
repo,
title,
body,
labels: ['content-refresh'],
});
core.info(`Created issue #${created.data.number}`);
}
env:
VALIDATE_OUTPUT: ${{ steps.validate.outputs.output }}
- name: Fail on errors
if: steps.validate.outcome == 'failure'
run: exit 1