Skip to content

Commit

Permalink
Exit in case output is set in args and action input
Browse files Browse the repository at this point in the history
I decided to make this a hard error, because it keeps the entrypoint simple.

Fixes #201
  • Loading branch information
mre committed Apr 25, 2024
1 parent 8f53060 commit 871733a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ jobs:
cat "${{ env.CUSTOM_OUTPUT_DUMP_PATH }}"
fi
- name: test output set in args and action input
id: output_set_in_args_and_action_input
uses: ./
with:
args: --output foo -
output: bar
continue-on-error: true

- name: test output set in args and action input should fail - validation
if: steps.output_set_in_args_and_action_input.outcome != 'failure'
run: |
echo "Output set in args and action input should have failed."
exit 1
- name: test failIfEmpty - no links in input should fail the pipeline
id: fail_if_empty_test
uses: ./
Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ FORMAT=""
# If `format` occurs in args, ignore the value from `INPUT_FORMAT`
[[ "$ARGS" =~ "--format " ]] || FORMAT="--format ${INPUT_FORMAT}"

# If `output` occurs in args and `INPUT_OUTPUT` is set, exit with an error
if [[ "$ARGS" =~ "--output " ]] && [ -n "${INPUT_OUTPUT:-}" ]; then
echo "Error: 'output' is set in args as well as in the action configuration. Please remove one of them."
exit 1
fi

# Execute lychee
eval lychee ${FORMAT} --output ${LYCHEE_TMP} ${ARGS}
exit_code=$?
Expand Down

0 comments on commit 871733a

Please sign in to comment.