generated from shuding/nextra-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 40
60 lines (49 loc) · 1.42 KB
/
link_checker.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
58
59
60
name: Link checker
on:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 12 * * *'
defaults:
run:
shell: bash
jobs:
link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install
- name: Install playwright browsers
run: yarn playwright install
- name: Run crawler for PR (local build)
if: github.event_name == 'pull_request'
env:
BASE_URL: "http://localhost:3000"
run: |
yarn build
sleep 5
echo "Starting local build..."
yarn start &
sleep 10
echo "Running link checker for local build at ${BASE_URL}"
yarn tsx scripts/checkLinks.ts
- name: Run crawler for deployed docs
if: github.event_name != 'pull_request'
env:
BASE_URL: "https://www.docs.sei.io/"
run: |
echo "Running link checker for deployed docs at ${BASE_URL}"
yarn tsx scripts/checkLinks.ts
- name: Upload broken links artifact
if: steps.crawler.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: broken-links
path: brokenLinks.json
- name: Fail job if crawler finds broken links
if: steps.crawler.outcome == 'failure'
run: exit 1