Skip to content

Commit

Permalink
test: allow triggering role test with label
Browse files Browse the repository at this point in the history
Signed-off-by: gardar <gardar@users.noreply.github.com>
  • Loading branch information
gardar committed May 15, 2023
1 parent 5ec83d5 commit d286f91
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ansible-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- edited
- reopened
- synchronize
- labeled
workflow_dispatch:

env:
Expand Down Expand Up @@ -68,10 +69,15 @@ jobs:
since_last_remote_commit: "true"

- name: Discover role tests
if: steps.changed-roles.outputs.any_changed == 'true'
if: ${{ (steps.changed-roles.outputs.any_changed == 'true') || (contains(github.event.label.name, 'test-role-')) }}
id: set-molecule-tests
run: |
echo tests="[`for role in ${{ steps.changed-roles.outputs.all_changed_and_modified_files }}; do
set -x
test-role="${${{ github.event.label.name }}##*-}"
roles=${{ steps.changed-roles.outputs.all_changed_and_modified_files }}
roles+="${test-role}"
echo $roles
echo tests="[`for role in $roles; do
for test in $(find tests/integration/targets -maxdepth 1 -mindepth 1 -type d -iname "molecule-${role}-*" -printf "%f\n"); do
echo '{"test":\"'"${test}"'\","name":\"'"${test#*-}\"'"}';
done
Expand Down

0 comments on commit d286f91

Please sign in to comment.