Skip to content

chore(deps-dev): bump postcss from 8.5.14 to 8.5.18 in the npm_and_yarn group across 1 directory #235

chore(deps-dev): bump postcss from 8.5.14 to 8.5.18 in the npm_and_yarn group across 1 directory

chore(deps-dev): bump postcss from 8.5.14 to 8.5.18 in the npm_and_yarn group across 1 directory #235

# .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: "18"
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.
# ESLINT_USE_FLAT_CONFIG=false is required because the repo uses .eslintrc.json (ESLint v8 format).
env:
ESLINT_USE_FLAT_CONFIG: "false"
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
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: "18"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Fix JavaScript and CSS issues
env:
ESLINT_USE_FLAT_CONFIG: "false"
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: 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"