File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ name : " Gitleaks"
2+
3+ on :
4+ pull_request :
5+
6+ env :
7+ GIT_GITLEAKS_VERSION : 8.18.4
8+ ACTIONS_STEP_DEBUG : ' ${{ secrets.ACTIONS_STEP_DEBUG }}'
9+
10+ jobs :
11+ gitleaks :
12+ name : " Gitleaks"
13+ runs-on : ubuntu-latest
14+ steps :
15+ 16+
17+ - name : Configure gitleaks binary cache
18+ id : cache
19+ uses : actions/cache@v4
20+ with :
21+ path : /usr/local/bin/gitleaks
22+ key : gitleaks-${{ env.GIT_GITLEAKS_VERSION }}
23+
24+ - name : Install tools
25+ if : steps.cache.outputs.cache-hit != 'true'
26+ run : |
27+ wget -O - \
28+ "https://github.com/zricethezav/gitleaks/releases/download/v${{ env.GIT_GITLEAKS_VERSION }}/gitleaks_${{ env.GIT_GITLEAKS_VERSION }}_linux_x64.tar.gz" \
29+ | sudo tar xzf - -C /usr/local/bin
30+
31+ - name : Checkout
32+ uses : actions/checkout@v4
33+ with :
34+ fetch-depth : 0
35+ ref : ${{ github.event.pull_request.head.sha || github.event.after }}
36+
37+ - name : Run gitleaks
38+ run : |
39+ set -euo pipefail ${ACTIONS_STEP_DEBUG:+-x}
40+
41+ gitleaks \
42+ detect \
43+ --source="." \
44+ --redact \
45+ -v \
46+ --exit-code=2 \
47+ --report-format=sarif \
48+ --report-path=results.sarif \
49+ --log-level=debug \
50+ --log-opts='${{ github.event.pull_request.head.sha || github.event.after }}..${{ github.event.pull_request.base.sha || github.event.before }}'
51+
52+ - name : Upload test results
53+ if : failure()
54+ uses : actions/upload-artifact@v4
55+ with :
56+ name : GitLeaks results
57+ path : results.sarif
You can’t perform that action at this time.
0 commit comments