Files

77 lines
1.9 KiB
YAML

name: lint-format
on:
push:
branches: [main]
permissions:
contents: write
concurrency:
group: lint-format-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-format:
name: Lint & Format Fix
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run checks
id: check
continue-on-error: true
run: |
bun run lint
bun run format:check
bun run lint:md
- name: Apply fixes
run: |
bunx eslint . --fix
bunx prettier --write .
bunx markdownlint "**/*.md" --ignore node_modules --ignore dist --fix
- name: Commit and push fixes
if: steps.check.outcome == 'failure'
uses: siiway/verified_bot_commit@v0
with:
message: "chore: auto-fix lint & formatting [skip ci]"
# Explicit whitelist instead of "**": the action downloads its own
# binary with `curl -o archive.tar.gz` into the workspace root, so
# "**" would commit that tarball (happened in Oct 2026). The
# archive.* entries in .gitignore are the second line of defense.
files: |
app/**
server/**
tests/**
docs/**
public/**
migrations/**
.github/**
*.md
*.ts
*.js
*.json
*.jsonc
*.yaml
*.yml
*.css
*.vue
ref: ${{ github.head_ref || github.ref }}
if-no-commit: notice
- name: Verify fixes
run: |
bun run lint
bun run format:check
bun run lint:md