Skip to content

Commit c00a72c

Browse files
committed
Removing hardcoded options in GHA docker run and providing output configuration
outputting results outputting results outputting results outputting results outputting results outputting results outputting results Attempting to mount github workspace for commit scans Adding back in hardcoded options, but electing to use GHA vars Adding in explicit no_fail input and check
1 parent 4a480c1 commit c00a72c

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

action.yml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
head:
1515
description: Scan commits until here (usually dev branch).
1616
required: false
17+
no_fail:
18+
description: When set, trufflehog does not exit with a 183 code when a credential is found.
19+
required: false
20+
default: ''
1721
extra_args:
1822
default: ""
1923
description: Extra args to be passed to the trufflehog cli.
@@ -22,6 +26,10 @@ inputs:
2226
default: "latest"
2327
description: Scan with this trufflehog cli version.
2428
required: false
29+
outputs:
30+
results:
31+
description: "Trufflehog scan outputs"
32+
value: ${{ steps.trufflehog.outputs.results }}
2533
branding:
2634
icon: "shield"
2735
color: "green"
@@ -30,6 +38,7 @@ runs:
3038
using: "composite"
3139
steps:
3240
- shell: bash
41+
id: trufflehog
3342
working-directory: ${{ inputs.path }}
3443
env:
3544
BASE: ${{ inputs.base }}
@@ -90,17 +99,27 @@ runs:
9099
HEAD=${{github.event.pull_request.head.sha}}
91100
fi
92101
fi
93-
##########################################
94-
## Run TruffleHog ##
95-
##########################################
96-
docker run --rm -v .:/tmp -w /tmp \
97-
ghcr.io/trufflesecurity/trufflehog:${VERSION} \
98-
git file:///tmp/ \
99-
--since-commit \
100-
${BASE:-''} \
101-
--branch \
102-
${HEAD:-''} \
103-
--fail \
104-
--no-update \
105-
--github-actions \
106-
${ARGS:-''}
102+
fi
103+
##########################################
104+
## Determine additional args ##
105+
##########################################
106+
if [ -n "$NO_FAIL" ]; then
107+
FAIL=""
108+
else
109+
FAIL="--fail"
110+
fi
111+
##########################################
112+
## Run TruffleHog ##
113+
##########################################
114+
results=$(docker run --rm -v ${{ github.workspace }}:/tmp -w /tmp \
115+
ghcr.io/trufflesecurity/trufflehog:${VERSION} \
116+
git file:///tmp/ \
117+
--since-commit \
118+
${BASE:-''} \
119+
--branch \
120+
${HEAD:-''} \
121+
${FAIL} \
122+
--no-update \
123+
--github-actions \
124+
${ARGS:-''})
125+
echo "results='$(echo $results)'" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)