# Drop into .github/workflows/. Scans the full git history of every PR and push.
# Personal-account repos need no licence. Organisation repos need a free
# GITLEAKS_LICENSE secret from gitleaks.io (uncomment the line below).
name: gitleaks

on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read
  pull-requests: write   # lets the action comment on the offending line

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0   # full history, not just the latest commit
      - uses: gitleaks/gitleaks-action@v3
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          # GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
