-
Notifications
You must be signed in to change notification settings - Fork 2.6k
55 lines (46 loc) · 1.72 KB
/
link-check.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
name: Check for broken links
on:
pull_request:
branches: ["develop"]
types: [synchronize, opened]
paths:
- "docs/**"
- ".github/workflows/link-check.yml"
workflow_dispatch:
jobs:
wait_for_netlify:
runs-on: ubuntu-latest
steps:
- name: Wait for Netlify deploy preview to complete
run: echo "Netlify deploy preview has passed"
if: ${{ contains(github.event.pull_request.head.repo.status.contexts, 'netlify') }}
check_links:
runs-on: ubuntu-latest
needs: wait_for_netlify
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm install broken-link-checker
- name: Run broken-link-checker and fail on broken links for Label Studio Docs
run: |
npx blc https://deploy-preview-${{ github.event.pull_request.number }}--label-studio-docs-new-theme.netlify.app -roef --exclude "/api" --filter-level 0
exit_code=$? # Capture the exit code
echo "Exit code: $exit_code" # Print the exit code
if [ $exit_code -ne 0 ]; then
echo "Broken links found!"
exit 1
fi
- name: Run broken-link-checker and fail on broken links for Human Signal Docs
run: |
npx blc https://deploy-preview-${{ github.event.pull_request.number }}--heartex-docs.netlify.app -roef --exclude "/api" --filter-level 0
exit_code=$? # Capture the exit code
echo "Exit code: $exit_code" # Print the exit code
if [ $exit_code -ne 0 ]; then
echo "Broken links found!"
exit 1
fi