Skip to content

Check Links

Check Links #12

Workflow file for this run

name: Check Links
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Run weekly on Sundays at midnight UTC
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
link-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Link Checker
uses: lycheeverse/lychee-action@v1
with:
args: --verbose --no-progress './README.md'
fail: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Issue on Failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const title = 'Link Check Failed';
const body = `The automated link check has found broken links. Please review the workflow run for details.`;
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'broken-link'
});
const existingIssue = issues.data.find(issue => issue.title === title);
if (!existingIssue) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['broken-link']
});
}