-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Action for automated link checking on PRs
- Loading branch information
1 parent
ece2001
commit 4ec6853
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
# Step 2: Set up Node.js environment | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' # Specify Node.js 20.x | ||
|
||
# Step 3: Install dependencies | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
# Step 4: Build and serve the site on a dynamic port | ||
- name: Build and serve the site | ||
run: npm run serve-only & | ||
|
||
# Step 5: Wait for the server to start | ||
# We're confident .eleventy-port is created immediately after determining the port | ||
- name: Wait for server to start | ||
run: sleep 10 # Adjust as needed based on server start time | ||
|
||
# Step 6: Run the link checker | ||
- name: Run link checker | ||
run: npm run link-check | ||
|
||
# Step 7: 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters