-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 1.98 KB
/
gitleaks.yml
File metadata and controls
53 lines (48 loc) · 1.98 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
name: Gitleaks Secret Scanning
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
schedule:
# Weekly full scan on Monday at 3 AM UTC
- cron: "0 3 * * 1"
permissions:
contents: read
# FIX: gitleaks-action v2 calls GET /repos/{owner}/{repo}/pulls/{n}/commits
# on pull_request events to determine which commits to scan. Without this
# permission the API returns HTTP 403 "Resource not accessible by integration"
# crashing the action before any scan runs.
pull-requests: read
jobs:
gitleaks:
name: Scan for Secrets
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Run Gitleaks
id: gitleaks
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITLEAKS_CONFIG points to your custom rules file at repo root.
GITLEAKS_CONFIG: .gitleaks.toml
# FIX: In gitleaks-action v2, report format/path are controlled by env vars.
# The action does not support `with.args` in this pinned version.
GITLEAKS_REPORT_FORMAT: sarif
GITLEAKS_REPORT_PATH: results.sarif
# FIX: Disable built-in artifact upload and upload explicitly below.
# This avoids dependency on code-scanning integrations in private repos.
GITLEAKS_ENABLE_UPLOAD_ARTIFACT: false
- name: Upload Gitleaks report as workflow artifact
# Run even when gitleaks finds secrets (exit code 1) so the report is
# always available for review — but skip when the step was cancelled.
if: always() && steps.gitleaks.outcome != 'cancelled'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: gitleaks-report
path: results.sarif
if-no-files-found: ignore