Files
dependabot[bot] 656c9cb087 chore(deps): bump pnpm/action-setup from 6.1.0 to 6.1.1 (#23802)
Bumps [pnpm/action-setup](https://github.com/pnpm/action-setup) from 6.1.0 to 6.1.1.
- [Release notes](https://github.com/pnpm/action-setup/releases)
- [Commits](https://github.com/pnpm/action-setup/compare/ea17c68df8912ef543352723c149a84f56e3d413...73e46992e05b19abd31f2f3c20e0e7370d762115)

---
updated-dependencies:
- dependency-name: pnpm/action-setup
  dependency-version: 6.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-06 08:07:22 +00:00

50 lines
2.2 KiB
YAML

name: Format
on:
push:
branches:
- master
jobs:
format:
permissions:
contents: write # for Git to git push
name: Auto format
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: lts/*
cache: 'pnpm'
- run: pnpm i
- run: npm run format:description
- run: npm run format
# oxlint applies fixes in a single pass, so a fix can leave problems that only the next pass fixes or reports
# Repeat on the changed files until they stop changing, and fail instead of committing what lint rejects
# https://github.com/oxc-project/oxc/issues/16118
- name: Apply chained fixes
run: |
files=()
while IFS= read -r file; do files+=("$file"); done < <(git diff --name-only -- '*.js' '*.mjs' '*.ts' '*.tsx')
if [ ${#files[@]} -gt 0 ]; then
for _ in 1 2 3 4 5; do
before=$(git diff | git hash-object --stdin)
pnpm exec oxlint --type-aware --fix "${files[@]}" || true
pnpm exec oxfmt "${files[@]}"
if [ "$(git diff | git hash-object --stdin)" = "$before" ]; then
break
fi
done
pnpm exec oxlint --type-aware "${files[@]}"
fi
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git status
git diff-index --quiet HEAD || (git commit -m "style: auto format" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:master)