-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (56 loc) · 1.83 KB
/
gitleaks.yml
File metadata and controls
66 lines (56 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: 'CI - Gitleaks'
run-name: 'Gitleaks - "${{ github.ref_name }}"'
permissions:
contents: read
on:
push:
branches:
- "main"
pull_request:
branches:
- "**"
workflow_dispatch:
jobs:
scan:
name: ''
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6.0.2
with:
ref: ${{ github.ref }}
repository: '${{ github.repository }}'
fetch-depth: 0
submodules: true
- name: Install Gitleaks
env:
VERSION: 8.30.0
PLATFORM: linux
run: |
wget https://github.com/gitleaks/gitleaks/releases/download/v${VERSION}/gitleaks_${VERSION}_${PLATFORM}_x64.tar.gz
tar -xf gitleaks_${VERSION}_${PLATFORM}_x64.tar.gz
sudo mv gitleaks /usr/local/bin/
- name: Run Gitleaks
id: gitleaks
run: |
gitleaks detect --redact --report-format=json --report-path=gitleaks-report.json --exit-code=1
- name: Summary
if: always()
run: |
echo "## Gitleaks Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [[ "${{ steps.gitleaks.outcome }}" == "success" ]]; then
echo "- **Status**: ✅ " >> $GITHUB_STEP_SUMMARY
else
echo "- **Status**: ❌ " >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
if [[ -f gitleaks-report.json ]]; then
echo "### Leaks details:" >> $GITHUB_STEP_SUMMARY
jq -r '.[] | "- File: \(.File), Rule: \(.RuleID), Description: \(.Description), Commit: \(.Commit)"' gitleaks-report.json >> $GITHUB_STEP_SUMMARY
else
echo "No gitleaks report found." >> $GITHUB_STEP_SUMMARY
fi