Skip to content

fix(ci): [OPS-715] add gitleaks secret scanning #3

fix(ci): [OPS-715] add gitleaks secret scanning

fix(ci): [OPS-715] add gitleaks secret scanning #3

Workflow file for this run

name: gitleaks
on:
push:
branches: [main]
pull_request:
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
actions: read
checks: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
- name: Set scan range
id: range
run: |
NULL_SHA="0000000000000000000000000000000000000000"
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "log_opts=${{ github.event.pull_request.base.sha }}..HEAD" >> $GITHUB_OUTPUT
elif [ "${{ github.event.before }}" = "$NULL_SHA" ] || [ -z "${{ github.event.before }}" ] || [ "${{ github.event.forced }}" = "true" ]; then
echo "log_opts=" >> $GITHUB_OUTPUT
else
echo "log_opts=${{ github.event.before }}..HEAD" >> $GITHUB_OUTPUT
fi
- uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
GITLEAKS_LOG_OPTS: ${{ steps.range.outputs.log_opts }}