Skip to content

Commit

Permalink
Add GitHub Action for automated link checking on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnthompson committed Aug 23, 2024
1 parent ece2001 commit 5285fc2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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.x' # Adjust this to match your project's Node.js version

# Step 3: Install dependencies
- name: Install dependencies
run: npm install

# Step 4: Build the site and serve it on a dynamic port
- name: Build and serve the site
run: npm start

# Step 5: Run the link checker
- name: Run link checker
run: npm run link-check

# Step 6: 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

0 comments on commit 5285fc2

Please sign in to comment.