-
-
Notifications
You must be signed in to change notification settings - Fork 10
66 lines (54 loc) · 1.93 KB
/
validate-links.yml
File metadata and controls
66 lines (54 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Validate Links
on:
release:
types: [published]
schedule:
# Run weekly on Sundays at 2 AM UTC
- cron: '0 2 * * 0'
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
link-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check links in README.md
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: '.github/link-check-config.json'
file-path: './README.md'
- name: Check links in index.md
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: '.github/link-check-config.json'
file-path: './index.md'
- name: Create issue if links are broken
if: failure()
uses: actions/github-script@v7
with:
script: |
const title = `🔗 Broken links detected - ${new Date().toISOString().split('T')[0]}`;
const body = `
## Broken Links Detected
The automated link checker has found broken links in the repository.
**Triggered by:** ${{ github.event_name }}
**Date:** ${new Date().toISOString()}
Please review the workflow logs for details about which links are broken:
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
---
This issue was automatically created by the link validation workflow.
`;
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['bug', 'documentation']
});