Skip to content

Commit

Permalink
feat(*): Exclude release tagged tests for push workflow (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienloizelet authored Oct 28, 2024
1 parent e69436a commit da4d15f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
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

0 comments on commit da4d15f

Please sign in to comment.