Skip to content

Commit d86881d

Browse files
committed
Fix pre-commit on CI and only run on changed files
1 parent b73f92a commit d86881d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/pre-commit.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v5
13+
with:
14+
fetch-depth: 0
1315
- uses: ./.github/actions/bootstrap
16+
- run: npm ci
17+
working-directory: src/Elastic.Documentation.Site
1418
- uses: actions/setup-python@v6
15-
- uses: pre-commit/[email protected]
19+
- name: Run pre-commit on PRs
20+
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
21+
if: ${{ github.event.pull_request }}
22+
with:
23+
extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
24+
- name: Run pre-commit on branches
25+
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
26+
if: ${{ ! github.event.pull_request }}

0 commit comments

Comments
 (0)