Skip to content

chore: governance snapshot from registry@2039580 #529

chore: governance snapshot from registry@2039580

chore: governance snapshot from registry@2039580 #529

# .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: 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@fc06bc1257f339d1d5d8b3a19a8cae5388b55320
# uses: pnpm/action-setup@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
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: Proof HTML files
uses: anishathalye/proof-html@a76b66427e600c6992e8937a741afffd2264a613
# uses: anishathalye/proof-html@v2
continue-on-error: true
with:
directory: './src/templates'
################################################################
# JOB 2: 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@fc06bc1257f339d1d5d8b3a19a8cae5388b55320
# uses: pnpm/action-setup@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
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@04702edda442b2e678b25b537cec683a1493fcb9
# uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'chore: auto-fix JS/CSS lint issues'
branch: ${{ github.head_ref }}
file_pattern: 'src/js/**/*.js src/css/**/*.css'
if: steps.check-changes.outputs.changed == 'true'