diff --git a/README.md b/README.md index 2974ec2..dafdbd4 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ Default: `false`. If you want to run a customized test command, you can use this input. -If it's empty, the test command will be `bats tests --filter-tags !release` during a pull request workflow and `bats tests` otherwise. +If it's empty, the test command will be `bats tests --filter-tags !release` during _push_ or _pull request_ workflows and `bats tests` otherwise. Not required. diff --git a/action.yaml b/action.yaml index 2afc23a..da64a43 100644 --- a/action.yaml +++ b/action.yaml @@ -109,16 +109,23 @@ runs: TEST_COMMAND_INPUT: ${{ inputs.test_command }} # Use the addon path ADDON_PATH: ${{ inputs.addon_path }} + # Use the event name + GITHUB_EVENT_NAME: ${{ github.event_name }} shell: bash # Use of "set +H" to ensure that bash history expansion is disabled so that ! can be used in test command run: | set +H if [ -n "$TEST_COMMAND_INPUT" ]; then TEST_COMMAND="$TEST_COMMAND_INPUT" - elif [ "${{ github.event_name }}" == "pull_request" ]; then - TEST_COMMAND="bats tests --filter-tags !release" else - TEST_COMMAND="bats tests" + case "$GITHUB_EVENT_NAME" in + "push"|"pull_request") + TEST_COMMAND="bats tests --filter-tags !release" + ;; + *) + TEST_COMMAND="bats tests" + ;; + esac fi echo "Running: $TEST_COMMAND in $ADDON_PATH" cd $ADDON_PATH && $TEST_COMMAND