-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
entrypoint.sh
executable file
·34 lines (27 loc) · 1.15 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
cd "${GITHUB_WORKSPACE}" || exit 1
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
detect-secrets --version
git config --global --add safe.directory /github/workspace
if [ -n "${INPUT_BASELINE_PATH}" ]; then
# When .secrets.baseline is provided, the file is only updated and not written to stdout
detect-secrets scan ${INPUT_DETECT_SECRETS_FLAGS} --baseline ${INPUT_BASELINE_PATH} ${INPUT_WORKDIR}
mv ${INPUT_BASELINE_PATH} /tmp/.secrets.baseline
else
detect-secrets scan ${INPUT_DETECT_SECRETS_FLAGS} ${INPUT_WORKDIR} > /tmp/.secrets.baseline
fi
if [ "${INPUT_SKIP_AUDITED}" = "true" ]; then
SKIP_AUDITED_FLAG="--skip-audited"
fi
if [ "${INPUT_VERBOSE}" = "true" ]; then
VERBOSE_FLAG="--verbose"
fi
cat /tmp/.secrets.baseline | baseline2rdf ${SKIP_AUDITED_FLAG} ${VERBOSE_FLAG} \
| reviewdog -f=rdjson \
-name="${INPUT_NAME:-detect-secrets}" \
-filter-mode="${INPUT_FILTER_MODE:-added}" \
-reporter="${INPUT_REPORTER:-github-pr-check}" \
-fail-level="${INPUT_FAIL_LEVEL}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS}