chore(deps): bump actions/setup-node from 4 to 7 #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: gitleaks | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| inputs: | |
| scan_history: | |
| description: Run full Git history scan instead of commit-range scan | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: read | |
| jobs: | |
| scan: | |
| name: Secret scan | |
| runs-on: ubuntu-latest | |
| env: | |
| SCAN_HISTORY: ${{ github.event_name == 'workflow_dispatch' && inputs.scan_history || false }} | |
| BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} | |
| HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install gitleaks | |
| env: | |
| GITLEAKS_VERSION: v8.30.1 | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| curl -sSfL "https://github.com/gitleaks/gitleaks/releases/download/${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION#v}_linux_x64.tar.gz" -o gitleaks.tar.gz | |
| tar -xzf gitleaks.tar.gz gitleaks | |
| sudo install -m 0755 gitleaks /usr/local/bin/gitleaks | |
| gitleaks version | |
| - name: Run gitleaks | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ "${SCAN_HISTORY}" = "true" ]; then | |
| gitleaks git . --redact --verbose | |
| elif [ -n "${BASE_SHA}" ] && ! [[ "${BASE_SHA}" =~ ^0+$ ]]; then | |
| gitleaks git . --log-opts="${BASE_SHA}..${HEAD_SHA}" --redact --verbose | |
| else | |
| gitleaks git . --log-opts="-1 ${HEAD_SHA}" --redact --verbose | |
| fi |