Skip to content

Commit 828eeb9

Browse files
authored
refactor: simplify passing of options (#53)
1 parent c245219 commit 828eeb9

File tree

2 files changed

+30
-38
lines changed

2 files changed

+30
-38
lines changed

action.yml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,40 @@ runs:
9393
- id: run
9494
shell: bash
9595
env:
96+
BEARER_SCANNER: ${{ inputs.scanner }}
97+
BEARER_CONFIG_FILE: ${{ inputs.config-file }}
98+
BEARER_IGNORE_FILE: ${{ inputs.bearer-ignore-file }}
99+
BEARER_ONLY_RULE: ${{ inputs.only-rule }}
100+
BEARER_SKIP_RULE: ${{ inputs.skip-rule }}
101+
BEARER_SKIP_PATH: ${{ inputs.skip-path }}
102+
BEARER_EXCLUDE_FINGERPRINT: ${{ inputs.exclude-fingerprint }}
103+
BEARER_FORMAT: ${{ inputs.format }}
104+
BEARER_OUTPUT: ${{ inputs.output }}
105+
BEARER_EXIT_CODE: ${{ inputs.exit-code }}
106+
BEARER_SEVERITY: ${{ inputs.severity }}
107+
BEARER_API_KEY: ${{ inputs.api-key }}
108+
BEARER_QUIET: ${{ inputs.quiet }}
109+
BEARER_HIDE_PROGRESS_BAR: ${{ inputs.hide-progress-bar }}
96110
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
97111
PR_NUMBER: ${{ github.event.pull_request.number }}
98112
CURRENT_BRANCH: ${{ github.head_ref }}
99113
DIFF_BASE_BRANCH: ${{ fromJSON(inputs.diff) && github.base_ref || '' }}
100114
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
101115
GITHUB_TOKEN: ${{ github.token }}
102116
run: |
103-
$GITHUB_ACTION_PATH/entrypoint.sh \
104-
"--scanner=${{ inputs.scanner }}" \
105-
"--config-file=${{ inputs.config-file }}" \
106-
"--bearer-ignore-file=${{ inputs.bearer-ignore-file }}" \
107-
"--only-rule=${{ inputs.only-rule }}" \
108-
"--skip-rule=${{ inputs.skip-rule }}" \
109-
"--skip-path=${{ inputs.skip-path }}" \
110-
"--exclude-fingerprint=${{ inputs.exclude-fingerprint }}" \
111-
"--format=${{ inputs.format }}" \
112-
"--output=${{ inputs.output }}" \
113-
"--exit-code=${{ inputs.exit-code }}" \
114-
"--severity=${{ inputs.severity }}" \
115-
"--api-key=${{ inputs.api-key }}" \
116-
"--quiet=${{ inputs.quiet }}" \
117-
"--hide-progress-bar=${{ inputs.hide-progress-bar }}" \
118-
"--path=${{ inputs.path }}"
117+
set +e
118+
RULE_BREACHES=`$RUNNER_TEMP/bearer scan "${{ inputs.path }}"`
119+
SCAN_EXIT_CODE=$?
120+
set -e
121+
122+
echo "::debug::$RULE_BREACHES"
123+
124+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
125+
126+
echo "rule_breaches<<$EOF" >> $GITHUB_OUTPUT
127+
echo "$RULE_BREACHES" >> $GITHUB_OUTPUT
128+
echo "$EOF" >> $GITHUB_OUTPUT
129+
130+
echo "exit_code=$SCAN_EXIT_CODE" >> $GITHUB_OUTPUT
131+
132+
exit $SCAN_EXIT_CODE

entrypoint.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)