-
Notifications
You must be signed in to change notification settings - Fork 599
57 lines (56 loc) · 1.99 KB
/
check-links.yml
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
name: Broken Links
on:
pull_request:
types: [synchronize, ready_for_review, opened, labeled, unlabeled]
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
env:
BUNDLE_GITHUB__COM: x-access-token:${{ secrets.BUNDLE_GITHUB__COM }}
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check if manual review has been performed
uses: actions/github-script@v7
id: labels
with:
script: |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
...context.repo,
issue_number: context.issue.number
});
return labels.map(l => l.name).includes('ci:manual-approve:link-validation')
outputs:
result: ${{ steps.labels.outputs.result }}
build:
needs: [check]
if: needs.check.outputs.result == 'false' && !contains(github.event.pull_request.title, '[skip ci]')
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Wait for Pages changed to be neutral
uses: fountainhead/[email protected]
id: waitForCheck
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
checkName: "Pages changed - kongdocs"
- name: Wait for Netlify site to be ready
if: steps.waitForCheck.outputs.conclusion == 'neutral'
uses: jakepartusch/[email protected]
id: waitForNetlify
with:
site_name: "kongdocs"
max_timeout: 120
- name: Run link checker
run: |
cd tools/broken-link-checker
npm ci
node run.js pr \
--base_url https://deploy-preview-${{ github.event.pull_request.number }}--kongdocs.netlify.app \
${{ runner.debug != '' && '--verbose' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}