Skip to content

Add workflow for validating redirects #8

Add workflow for validating redirects

Add workflow for validating redirects #8

name: Validate Redirects
on:
pull_request:
paths:
- 'public/_redirects'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
pull-requests: write
jobs:
validate:
name: Validate redirects
runs-on: ubuntu-latest
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: 🏗️ Build Site
working-directory: ./
env:
GOOGLE_PRIVATE_KEY: ${{ secrets.SA }}
NETLIFY: 1
run: |
npm install
npm run build
- name: 📦 Install Script Dependencies
working-directory: ./src/scripts
run: |
npm install
- name: ✔ Validate redirects
uses: maddog2050/executable-wrapper@v1
id: validate
with:
working-directory: ./src/scripts
run_command: node validate-redirects.mjs
- name: ✍️ Updating PR Comment
if: always()
uses: thollander/actions-comment-pull-request@v2
with:
message: |
### Redirects Validation Output
_(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
${{ steps.validate.outputs.stdout }}
comment_tag: validation-results