Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(*): Exclude release tagged tests for push workflow #38

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
13 changes: 10 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down