ci(secret-scan): fix gitleaks --source path (docker action host path) (#3)

The docker://zricethezav/gitleaks action mounts the workspace at
/github/workspace, but --source pointed at the host path from
github.workspace ($HOME/runner/work/...), which does not exist inside the
container -> 'stat ...: no such file or directory' on every run.

Follow the 2dph canon (ci.yml secret-scan): install the gitleaks binary
instead of the docker action and scan GITHUB_WORKSPACE - works on both
GitHub and Gitea act runners.
This commit is contained in:
2026-09-06 02:45:29 +01:00
parent c53b9d5a9c
commit 1607f760db
+15 -3
View File
@@ -34,8 +34,20 @@ jobs:
echo "Scanning range: $RANGE" echo "Scanning range: $RANGE"
- name: Gitleaks (diff-only, fail on leak) - name: Gitleaks (diff-only, fail on leak)
uses: docker://zricethezav/gitleaks:latest
env: env:
GITLEAKS_RANGE: ${{ env.RANGE }} GITLEAKS_RANGE: ${{ env.RANGE }}
with: run: |
args: detect --source "${{ github.workspace }}" --log-opts="$GITLEAKS_RANGE" --redact --verbose set -euo pipefail
# install the gitleaks binary (linux-amd64) instead of a docker action:
# the docker://zricethezav/gitleaks action hardcodes /github/workspace,
# which does not exist on the Gitea (act) runner. $GITHUB_WORKSPACE is the
# checkout dir on BOTH runners (GitHub and Gitea act).
curl -fsSLo /tmp/gitleaks.tar.gz \
https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
tar -xzf /tmp/gitleaks.tar.gz -C /tmp gitleaks
chmod +x /tmp/gitleaks
/tmp/gitleaks detect \
--source "$GITHUB_WORKSPACE" \
--log-opts="$GITLEAKS_RANGE" \
--redact \
--verbose