Skip to content

Commit 2302fbf

Browse files
authored
feat(ci): add trufflehog secrets detection (#745)
### What does this PR do? Adding a GH action to scan for leaked secrets on each commit.
1 parent 1e6c37e commit 2302fbf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/trufflehog.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Secret Leaks
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
trufflehog:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- shell: bash
11+
run: |
12+
if [ "${{ github.event_name }}" == "push" ]; then
13+
echo "depth=$(($(jq length <<< '${{ toJson(github.event.commits) }}') + 2))" >> $GITHUB_ENV
14+
echo "branch=${{ github.ref_name }}" >> $GITHUB_ENV
15+
fi
16+
if [ "${{ github.event_name }}" == "pull_request" ]; then
17+
echo "depth=$((${{ github.event.pull_request.commits }}+2))" >> $GITHUB_ENV
18+
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
19+
fi
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
ref: ${{env.branch}}
24+
fetch-depth: ${{env.depth}}
25+
- name: Secret Scanning
26+
uses: trufflesecurity/trufflehog@main

0 commit comments

Comments
 (0)