1
0
Fork 0
mirror of https://github.com/imjasonh/apidiff-action synced 2026-07-06 22:52:43 +00:00

Use pre-commit action in CI

- Replace individual lint/test/build steps with pre-commit action
- Ensures CI runs exactly the same checks as local development
- Includes dist up-to-date check via pre-commit hooks
This commit is contained in:
Jason Hall 2025-07-29 17:21:43 -04:00
parent 805c061497
commit f9bedf8b44
Failed to extract signature
3 changed files with 22 additions and 17 deletions

View file

@ -10,11 +10,15 @@ permissions:
contents: read
jobs:
test:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: actions/setup-node@v4
with:
node-version: '20'
@ -23,21 +27,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Check dist is up to date
run: |
if [ -n "$(git status --porcelain dist)" ]; then
echo "Generated dist files are out of date. Run 'npm run build' and commit the changes."
exit 1
fi
- uses: pre-commit/action@v3.0.1
# Test the action itself
test-action:

View file

@ -21,3 +21,18 @@ repos:
- id: eslint
files: \.js$
args: ['--fix']
- repo: local
hooks:
- id: build-dist
name: Build dist
entry: npm run build
language: system
pass_filenames: false
files: ^(index\.js|lib/.*\.js)$
- id: check-dist
name: Check dist is up to date
entry: bash -c 'if [ -n "$(git status --porcelain dist)" ]; then echo "dist is out of date. Run npm run build and commit the changes."; exit 1; fi'
language: system
pass_filenames: false
always_run: true