Skip to content

Commit 08a2d6f

Browse files
update gitleaks action
Signed-off-by: Roman Trofimenkov <roman.trofimenkov@flant.com>
1 parent 42725ea commit 08a2d6f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

gitleaks/action.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,18 @@ runs:
7171
run: |
7272
set -euo pipefail
7373
if [[ -f ".gitleaks.toml" ]]; then
74-
# Local config exists - it should extend the centralized one
75-
echo "config_arg=--config .gitleaks.toml" >> "$GITHUB_OUTPUT"
76-
echo "✅ Found local config: .gitleaks.toml (should extend base config)"
74+
# Local config exists - check if it has [extend] section
75+
if grep -q "^\[extend\]" .gitleaks.toml; then
76+
# Has extend section - use as is
77+
echo "config_arg=--config .gitleaks.toml" >> "$GITHUB_OUTPUT"
78+
echo "✅ Found local config with [extend] section - using as is"
79+
else
80+
# No extend section - warn and ignore, use base config only
81+
echo "⚠️ WARNING: Local config file .gitleaks.toml exists but does not contain [extend] section"
82+
echo " We cannot be sure this is the expected extend configuration."
83+
echo " Ignoring local config file and using base config only."
84+
echo "config_arg=--config ${RUNNER_TEMP}/gitleaks.base.toml" >> "$GITHUB_OUTPUT"
85+
fi
7786
else
7887
# Use centralized config only
7988
echo "config_arg=--config ${RUNNER_TEMP}/gitleaks.base.toml" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)