-
Notifications
You must be signed in to change notification settings - Fork 33
51 lines (41 loc) · 1.44 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
name: Link Checker
# Trigger the workflow on pull requests to the main or develop branches
on:
pull_request:
branches:
- main
- develop
jobs:
link-check:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository code using the latest version of actions/checkout
- name: Check out code
uses: actions/checkout@v4
# Step 2: Set up Node.js environment using the latest version
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '20' # Specify Node.js 20.x
# Step 3: Install dependencies
- name: Install dependencies
run: npm install
# Step 4: Create a temporary .eleventy-port file
- name: Create a temporary .eleventy-port file
run: echo "8080" > .eleventy-port
# Step 5: Build and serve the site on the specified port
- name: Build and serve the site
run: npm run serve-only &
# Step 6: Wait for the server to start
- name: Wait for server to start
run: sleep 10 # Adjust as needed based on server start time
# Step 7: Run the link checker
- name: Run link checker
run: npm run link-check
# Step 8: Upload broken links report if broken links are found
- name: Upload broken links report
if: failure()
uses: actions/upload-artifact@v2
with:
name: broken-links-report
path: broken-links.json