53 lines
1.2 KiB
YAML
53 lines
1.2 KiB
YAML
name: format
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Pixi
|
|
uses: prefix-dev/setup-pixi@v0.9.3
|
|
with:
|
|
pixi-version: v0.61.0
|
|
environments: develop
|
|
activate-environment: true
|
|
cache: true
|
|
locked: true
|
|
|
|
- name: Run check
|
|
id: precommit
|
|
run: |
|
|
pixi run ci-check
|
|
continue-on-error: true
|
|
|
|
- name: Show diff on failure
|
|
if: steps.precommit.outcome == 'failure'
|
|
run: |
|
|
echo "❌ pre-commit found issues that it auto-fixed."
|
|
echo " Please run 'pre-commit run --all-files' locally,"
|
|
echo " commit the changes, and push again."
|
|
echo ""
|
|
echo "👇 The required changes are shown below:"
|
|
git diff
|
|
|
|
- name: Fail the job if pre-commit failed
|
|
if: steps.precommit.outcome == 'failure'
|
|
run: |
|
|
echo "pre-commit checks failed."
|
|
exit 1
|
|
|
|
- name: Auto correct
|
|
uses: huacnlee/autocorrect-action@main
|
|
with:
|
|
args: --lint ./docs
|