Skip to content

Document the real Spoken Audio Node migration state, and fix the CI that hid it #146

Document the real Spoken Audio Node migration state, and fix the CI that hid it

Document the real Spoken Audio Node migration state, and fix the CI that hid it #146

# .github/workflows/proof-html-js-css.yml
name: Proof HTML, Lint JS & CSS
on:
push:
branches:
- main
- master
- develop
pull_request:
branches:
- main
- master
- develop
workflow_dispatch:
jobs:
################################################################
# JOB 1: AUTO-FIXER (The "Helper Bot")
# This job runs ONLY on pull requests.
# Its job is to fix simple errors and push them back to the PR branch.
################################################################
auto-fix:
name: Auto-fix JS & CSS
runs-on: ubuntu-latest
# CRITICAL: This condition ensures the job only runs for pull requests.
if: github.event_name == 'pull_request'
permissions:
contents: write # This job needs permission to push code.
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup pnpm
# uses: pnpm/action-setup@v4
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Fix JavaScript and CSS issues
run: |
pnpm exec eslint "src/js/**/*.js" --fix || true
pnpm exec stylelint "src/css/**/*.css" --fix || true
- name: Check for auto-fixable changes
id: check-changes
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "📝 No auto-fixable changes detected"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "📝 Auto-fixable changes detected:"
git diff --stat
fi
- name: Commit and push fixes (PR only)
# uses: stefanzweifel/git-auto-commit-action@v5
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9
with:
commit_message: 'chore: auto-fix JS/CSS lint issues'
branch: ${{ github.head_ref }}
file_pattern: 'src/js/**/*.js src/css/**/*.css'
if: github.event_name == 'pull_request' && steps.check-changes.outputs.changed == 'true'
- name: Upload fixes as artifact (protected branch)
if: github.event_name != 'pull_request' && steps.check-changes.outputs.changed == 'true'
uses: actions/upload-artifact@v4
with:
name: auto-fixes
path: |
src/js/**/*.js
src/css/**/*.css
retention-days: 7
- name: Branch protection notice
if: github.event_name != 'pull_request' && steps.check-changes.outputs.changed == 'true'
run: |
echo "⚠️ Auto-fixes available but cannot commit to protected branch"
echo "📦 Fixed files uploaded as workflow artifact"
echo "📝 Download artifact or run 'npm run fix' locally and commit manually"
################################################################
# JOB 2: LINTER & PROOFER (The "Enforcer")
# This job runs on EVERY push and pull request.
# Its only job is to CHECK for errors and fail if it finds any.
################################################################
lint:
name: Lint & Proof Frontend Assets
runs-on: ubuntu-latest
permissions:
contents: read # This job only needs to read files.
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
# uses: pnpm/action-setup@v4
uses: jjs98/pnpm-install-action@f007626222b32398504ea7ef674c7ec1d8fd771d
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint JavaScript (Check only)
# We run WITHOUT --fix here. The goal is to report errors, not hide them.
run: pnpm exec eslint "src/js/**/*.js"
- name: Lint CSS (Check only)
# We run WITHOUT --fix here.
run: pnpm exec stylelint "src/css/**/*.css"
- name: Remove auto-generated PHP docs from proofer scope
# docs/php/ is generated by phpDocumentor and references bundled JS/CSS not committed to
# the repo, causing thousands of false-positive failures. Remove it from the workspace
# before running HTMLProofer (does not modify the repository).
run: rm -rf docs/php
- name: Proof HTML files
# uses: anishathalye/proof-html@v2
uses: anishathalye/proof-html@acec311c40ea13c9ffa6490e77ac67f52594f403
with:
directory: './docs'