Skip to content

improved link-checker #3

improved link-checker

improved link-checker #3

Workflow file for this run

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 the site and serve it on a dynamic port
- name: Build and serve the site
run: npm run serve-only &
# Step 5: Wait for the server to start
- name: Wait for server to start
run: sleep 15 # Increase wait time to ensure server starts and writes the .eleventy-port file
# Step 6: Check if .eleventy-port file exists
- name: Check if .eleventy-port file exists
run: ls -la .eleventy-port # This step ensures the .eleventy-port file has been created
# 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