Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/gitleaks-pr-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: 🔐 Gitleaks PR Scan

on:
workflow_call:
inputs:
checkout_ref:
description: 'Ref to checkout before scanning (optional).'
required: false
type: string
default: ''

permissions:
contents: read

jobs:
gitleaks:
name: 🔍 Gitleaks scan
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout
uses: actions/checkout@v6
with:
ref: ${{ inputs.checkout_ref != '' && inputs.checkout_ref || github.ref }}

- name: 🔐 Run gitleaks on PR changes
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
...
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Above example is just a simple example to call workflow from github shared workf
28. [Terraform Workflow](./docs/28.terraform_workflow.md)
29. [Terraform Module Tag Release Workflow (Shared)](./docs/29.tf-monorepo-tag-release.md)
30. [Terraform PR Plan Diff workflow](./docs/30.tf-pr-checks.md)
31. [Gitleaks PR Scan Workflow](./docs/31.gitleaks-pr-scan.md)

## Feedback
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/github-shared-workflows/issues), or feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com).
Expand Down
29 changes: 29 additions & 0 deletions docs/31.gitleaks-pr-scan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## [Gitleaks PR Scan Workflow](https://github.com/clouddrove/github-shared-workflows/blob/master/.github/workflows/gitleaks-pr-scan.yml)

This reusable workflow runs Gitleaks to detect hardcoded secrets in pull requests. It is designed to be called from organization/module repositories via `workflow_call`.

#### Usage
Use this workflow when you want a centralized and consistent secret-scanning gate managed from `clouddrove/github-shared-workflows`.

### Highlights
- ✅ Reusable `workflow_call` implementation
- 🔐 Detects leaked credentials/secrets in PR code changes
- 🧩 Can be consumed by `.github` policy repos and module repos
- 🛡️ Uses `GITHUB_TOKEN` from caller context (`secrets: inherit`)

#### Example
```yaml
name: Gitleaks PR Secret Scan

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
gitleaks:
uses: clouddrove/github-shared-workflows/.github/workflows/gitleaks-pr-scan.yml@master
secrets: inherit
```