From 4a3bba78ccc53d3026c456f9b849e5a7185a5ccb Mon Sep 17 00:00:00 2001 From: Jeff Wenzbauer Date: Mon, 1 Aug 2022 16:05:08 -0600 Subject: [PATCH] Update github action to support generic cli command input (#670) * Update github action to support generic cli command input * revert removal of inputs * echo in entrypoint * test custom docker image * revert docker image reference --- Dockerfile | 5 +++-- action.yml | 5 +++++ entrypoint.sh | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) mode change 100644 => 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 8fc4eac6c..d84c78b72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,5 +12,6 @@ FROM alpine:3.15 RUN apk add --no-cache git COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=builder /build/trufflehog /usr/bin/trufflehog -ENTRYPOINT ["/usr/bin/trufflehog"] - +COPY entrypoint.sh /etc/entrypoint.sh +RUN chmod +x /etc/entrypoint.sh +ENTRYPOINT ["/etc/entrypoint.sh"] diff --git a/action.yml b/action.yml index 080e10214..134308a20 100644 --- a/action.yml +++ b/action.yml @@ -12,6 +12,10 @@ inputs: head: description: Scan commits until here (usually dev branch). required: false + extra_args: + default: '' + description: Extra args to be passed to the trufflehog cli. + required: false branding: icon: "shield" color: "green" @@ -26,3 +30,4 @@ runs: - --branch - ${{ inputs.head }} - --fail + - ${{ inputs.extra_args }} diff --git a/entrypoint.sh b/entrypoint.sh old mode 100644 new mode 100755 index 91f455a4b..4ef5e69bc --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,5 @@ -#! /usr/bin/env bash +#!/usr/bin/env ash -args=("$@") -/usr/bin/trufflehog ${args[@]} \ No newline at end of file +# `$*` expands the `args` supplied in an `array` individually +# or splits `args` in a string separated by whitespace. +/usr/bin/trufflehog $* \ No newline at end of file