Skip to content

Commit fd7c5ec

Browse files
committed
Add link verification workflow for pull requests
This commit introduces a new GitHub Actions workflow that verifies links in the application during pull requests. The workflow includes steps for checking out the repository, setting up Node.js and Python, installing dependencies, building the application, and running a link verification script against the application running locally. Signed-off-by: Pete Cheslock <[email protected]>
1 parent c2baa2d commit fd7c5ec

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Link Verification on Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ main, master ]
6+
types: [opened, synchronize, reopened]
7+
8+
jobs:
9+
link-verification:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '18'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Build the application
28+
run: npm run build
29+
30+
- name: Setup Python for link verifier
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: '3.11'
34+
35+
- name: Download and setup link verifier
36+
run: |
37+
curl -o requirements.txt https://raw.githubusercontent.com/jjasghar/link-verifier-llm-d.ai/9930050b977f00f78dbe8d361814f359115df492/requirements.txt
38+
curl -o link_verifier.py https://raw.githubusercontent.com/jjasghar/link-verifier-llm-d.ai/9930050b977f00f78dbe8d361814f359115df492/link_verifier.py
39+
pip install -r requirements.txt
40+
41+
- name: Start the application in background
42+
run: |
43+
npm run start &
44+
echo $! > server.pid
45+
46+
- name: Wait for application to be ready
47+
run: |
48+
echo "Waiting for application to start on port 3000..."
49+
timeout=60
50+
counter=0
51+
52+
while [ $counter -lt $timeout ]; do
53+
if curl -f http://localhost:3000 >/dev/null 2>&1; then
54+
echo "✅ Application is ready!"
55+
break
56+
fi
57+
58+
echo "⏳ Waiting... ($counter/$timeout seconds)"
59+
sleep 1
60+
counter=$((counter + 1))
61+
done
62+
63+
if [ $counter -eq $timeout ]; then
64+
echo "❌ Application failed to start within $timeout seconds"
65+
exit 1
66+
fi
67+
68+
- name: Run link verification
69+
run: python link_verifier.py --url http://localhost:3000
70+
71+
- name: Cleanup
72+
if: always()
73+
run: |
74+
if [ -f server.pid ]; then
75+
kill $(cat server.pid) 2>/dev/null || true
76+
rm -f server.pid
77+
fi
78+
# Kill any remaining node processes
79+
pkill -f "docusaurus start" || true

0 commit comments

Comments
 (0)