-
Notifications
You must be signed in to change notification settings - Fork 202
62 lines (55 loc) · 2.28 KB
/
Copy pathhealthcheck-markdown-links.yml
File metadata and controls
62 lines (55 loc) · 2.28 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
name: Check health of document links
on:
# Manual-only. The automatic pull_request/push triggers were removed: the
# checker fails the whole job on any single flaky external link (e.g. a CDN
# returning 4xx to CI runners), which created noise and blocked PRs for little
# benefit. Run it on demand from the Actions tab when a link sweep is wanted.
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
linkChecker:
if: github.repository == 'EpicGames/PixelStreamingInfrastructure'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2.0.2
with:
args: --user-agent 'GHA/PixelStreamingInfrastructure' --accept '100..=103,200..=299,403,429' --exclude 'localhost' --exclude 'github.com/EpicGames/UnrealEngine' --exclude '.png' --exclude '.jpg' --exclude-path 'SFU/mediasoup-sdp-bridge/README.md' './**/*.md'
- name: Find existing link checker issue
id: find-issue
if: always()
uses: actions/github-script@v5
with:
result-encoding: string
script: |
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'automated issue',
});
const existing = issues.data.find(i => i.title === 'Link Checker Report');
return existing ? String(existing.number) : '';
- name: Create or update link checker issue
if: env.lychee_exit_code != 0
uses: peter-evans/create-issue-from-file@v4
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated issue
issue-number: ${{ steps.find-issue.outputs.result }}
- name: Close existing issue if all links pass
if: env.lychee_exit_code == 0 && steps.find-issue.outputs.result != ''
uses: actions/github-script@v5
with:
script: |
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ steps.find-issue.outputs.result }},
state: 'closed'
});