forked from actions/upload-release-asset
-
Notifications
You must be signed in to change notification settings - Fork 6
49 lines (41 loc) · 1.23 KB
/
pre-commit-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: "Pre-commit consistency check"
on:
workflow_dispatch:
pull_request:
concurrency:
group: ${{ github.head_ref }}-precommit
cancel-in-progress: true
jobs:
pre-commit-check:
name: Run pre-commit checks
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
addedOrModified:
- added|modified: '**'
- name: Set Node.js 16.x
uses: actions/setup-node@v2.5.1
with:
node-version: 16.x
- name: Install dependencies
run: npm ci
# run only if changed files were detected
- name: Run against changes
uses: pre-commit/action@v2.0.3
if: steps.filter.outputs.addedOrModified == 'true'
with:
extra_args: --files ${{ steps.filter.outputs.addedOrModified_files }}
# run if no changed files were detected (e.g. workflow_dispatch on master branch)
- name: Run against all files
uses: pre-commit/action@v2.0.3
if: steps.filter.outputs.addedOrModified != 'true'
with:
extra_args: --all-files