Skip to content

Commit

Permalink
Adds optional path argument
Browse files Browse the repository at this point in the history
Allows users to specify a path_arg instead of the default `.` and it
will be used when starting the scan

Co-authored-by: Nate Vick <[email protected]>
  • Loading branch information
benjaminwood and natevick committed Oct 31, 2023
1 parent 6660b67 commit f7a6553
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ inputs:
description: "Forces the exit-code when errors are reported"
required: false
default: ""
path:
description: "The path to scan"
required: false
default: "."
outputs:
rule_breaches:
description: "Details of any rule breaches that occur"
Expand Down Expand Up @@ -110,4 +114,5 @@ runs:
"--severity=${{ inputs.severity }}" \
"--api-key=${{ inputs.api-key }}" \
"--quiet=${{ inputs.quiet }}" \
"--hide-progress-bar=${{ inputs.hide-progress-bar }}"
"--hide-progress-bar=${{ inputs.hide-progress-bar }}" \
"--path=${{ inputs.path }}"
5 changes: 4 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# Filter out any empty args
args=$(for var in "$@"; do echo "$var";done | grep =.)

RULE_BREACHES=`$RUNNER_TEMP/bearer scan ${args//$'\n'/ } .`
path_arg=$(echo "$args" | grep -oP '(?<=--path=)[^\s]+')
other_args=$(echo "$args" | sed -E 's/--path=[^\s]+//')

RULE_BREACHES=`$RUNNER_TEMP/bearer scan ${other_args//$'\n'/ } $path_arg`
SCAN_EXIT_CODE=$?

echo "::debug::$RULE_BREACHES"
Expand Down

0 comments on commit f7a6553

Please sign in to comment.