Skip to content

Commit 133bc54

Browse files
authored
fix(ci): [OPS-715] add gitleaks secret scanning (#5)
1 parent b0740ec commit 133bc54

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/gitleaks.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: gitleaks
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
jobs:
7+
scan:
8+
name: gitleaks
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
actions: read
14+
checks: write
15+
steps:
16+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
17+
with:
18+
fetch-depth: 0
19+
persist-credentials: false
20+
- name: Set scan range
21+
id: range
22+
run: |
23+
NULL_SHA="0000000000000000000000000000000000000000"
24+
if [ "${{ github.event_name }}" = "pull_request" ]; then
25+
echo "log_opts=${{ github.event.pull_request.base.sha }}..HEAD" >> $GITHUB_OUTPUT
26+
elif [ "${{ github.event.before }}" = "$NULL_SHA" ] || [ -z "${{ github.event.before }}" ] || [ "${{ github.event.forced }}" = "true" ]; then
27+
echo "log_opts=" >> $GITHUB_OUTPUT
28+
else
29+
echo "log_opts=${{ github.event.before }}..HEAD" >> $GITHUB_OUTPUT
30+
fi
31+
- uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
35+
GITLEAKS_LOG_OPTS: ${{ steps.range.outputs.log_opts }}

0 commit comments

Comments
 (0)