Skip to content
Merged
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
11 changes: 9 additions & 2 deletions gitleaks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,15 @@ runs:
set -euo pipefail
CONFIG_ARG="${{ steps.config.outputs.config_arg }}"

BASE_COMMIT=$(git rev-parse HEAD^1)
echo "Base commit: $BASE_COMMIT"
BASE_REF="${{ github.event.pull_request.base.ref }}"
BASE_REMOTE_REF="refs/remotes/origin/${BASE_REF}"

git fetch --no-tags --prune origin "+refs/heads/${BASE_REF}:${BASE_REMOTE_REF}"
BASE_COMMIT=$(git merge-base HEAD "$BASE_REMOTE_REF")

echo "PR base branch: ${BASE_REF}"
echo "PR base ref: ${BASE_REMOTE_REF}"
echo "Merge-base commit: ${BASE_COMMIT}"
echo "Scanning range: ${BASE_COMMIT}..HEAD"

gitleaks detect --no-banner --redact --log-level debug \
Expand Down
Loading