Skip to content

Commit 7dcd2f7

Browse files
authored
Merge pull request #131 from semgrep/inline-pinned-precommit
ci: replace pre-commit/action with direct pre-commit run [SEC-2494]
2 parents 81704b3 + d9ea2d6 commit 7dcd2f7

1 file changed

Lines changed: 24 additions & 19 deletions

File tree

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
name: pre-commit-hook-test
2+
on:
3+
pull_request: null
4+
push:
5+
branches:
6+
- develop
7+
18
jobs:
29
test-hooks:
310
runs-on: ubuntu-latest
@@ -7,26 +14,24 @@ jobs:
714
run: git config --global --add safe.directory "$(pwd)"
815
- name: Fake update file
916
run: git mv tests/python_simple.py python_simple.py
10-
- name: Test semgrep pre-commit hook
11-
uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
17+
- name: Set up uv
18+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
1219
with:
13-
extra_args: semgrep --hook-stage manual --files python_simple.py
14-
- name: Test semgrep-ci pre-commit hook
15-
uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
20+
enable-cache: true
21+
cache-dependency-glob: .pre-commit-config.yaml
22+
version: "0.11.x"
23+
- name: Cache pre-commit hook envs
24+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
1625
with:
17-
extra_args: semgrep-ci --hook-stage manual --files python_simple.py
26+
path: ~/.cache/pre-commit
27+
key: pre-commit-v1|${{ hashFiles('.pre-commit-config.yaml') }}
28+
- name: Install pre-commit
29+
run: UV_EXCLUDE_NEWER="1 week" uv tool install pre-commit --with pre-commit-uv
30+
- name: Test semgrep pre-commit hook
31+
run: pre-commit run --show-diff-on-failure --color=always semgrep --hook-stage manual --files python_simple.py
32+
- name: Test semgrep-ci pre-commit hook
33+
run: pre-commit run --show-diff-on-failure --color=always semgrep-ci --hook-stage manual --files python_simple.py
1834
- name: Test semgrep-docker-develop pre-commit hook
19-
uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
20-
with:
21-
extra_args: semgrep-docker-develop --hook-stage manual --files python_simple.py
35+
run: pre-commit run --show-diff-on-failure --color=always semgrep-docker-develop --hook-stage manual --files python_simple.py
2236
- name: Test semgrep-docker pre-commit hook
23-
uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
24-
with:
25-
extra_args: semgrep-docker --hook-stage manual --files python_simple.py
26-
27-
name: pre-commit-hook-test
28-
on:
29-
pull_request: null
30-
push:
31-
branches:
32-
- develop
37+
run: pre-commit run --show-diff-on-failure --color=always semgrep-docker --hook-stage manual --files python_simple.py

0 commit comments

Comments
 (0)