-
Notifications
You must be signed in to change notification settings - Fork 851
Expand file tree
/
Copy pathpython-check-markdown-links.yml
More file actions
52 lines (44 loc) · 1.72 KB
/
python-check-markdown-links.yml
File metadata and controls
52 lines (44 loc) · 1.72 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
name: "Python: Check Markdown Links"
on:
schedule:
- cron: '0 9 * * 1' # Every Monday at 9am UTC
workflow_dispatch: # Allow manual trigger
jobs:
check-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/github-action-markdown-link-check@3c3b66f1f7d0900e37b71eca45b63ea9eedfce31 # v1.0.17
id: link-check
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: 'strands-py/.markdown-link-check.json'
folder-path: 'strands-py'
continue-on-error: true
- name: Create issue if links are broken
if: steps.link-check.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
const title = '🔗 Broken markdown links detected';
const label = 'broken-links';
// Check for existing open issue to avoid duplicates
const existing = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: label,
});
if (existing.data.length > 0) {
console.log(`Issue already exists: #${existing.data[0].number}`);
return;
}
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body: `The weekly markdown link check found broken links.\n\nSee the [workflow run](${runUrl}) for details.`,
labels: [label],
});