File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
12name : Ansible – Lint and Test
23
34on :
1617 - " !ansible/**/README*"
1718 - " .github/workflows/ansible-lint-and-test.yml"
1819 workflow_dispatch :
19-
2020jobs :
2121 detect-changes :
2222 if : github.event_name != 'workflow_dispatch'
@@ -50,31 +50,31 @@ jobs:
5050 id : normalize
5151 run : |
5252 set -euo pipefail
53-
53+
5454 ROLES_FILES='${{ steps.filter.outputs.roles_files }}'
5555 PLAYBOOKS_FILES='${{ steps.filter.outputs.playbooks_files }}'
56-
56+
5757 # Extract unique role directories using jq only
5858 ROLES_JSON=$(echo "$ROLES_FILES" | jq -c '[.[] | select(startswith("ansible/roles/")) | split("/") | "ansible/roles/" + .[2]] | unique')
59-
59+
6060 # Extract unique playbook files
6161 PLAYBOOKS_JSON=$(echo "$PLAYBOOKS_FILES" | jq -c 'unique')
62-
62+
6363 # Combine roles + playbooks for targets
6464 TARGETS_JSON=$(jq -nc --argjson r "$ROLES_JSON" --argjson p "$PLAYBOOKS_JSON" '$r + $p | unique')
65-
65+
6666 # Boolean flags
6767 HAS_TARGETS=$(echo "$TARGETS_JSON" | jq -r 'length > 0')
6868 HAS_PLAYBOOKS=$(echo "$PLAYBOOKS_JSON" | jq -r 'length > 0')
69-
69+
7070 {
7171 echo "roles_json=$ROLES_JSON"
7272 echo "playbooks_json=$PLAYBOOKS_JSON"
7373 echo "targets_json=$TARGETS_JSON"
7474 echo "has_targets=$HAS_TARGETS"
7575 echo "has_playbooks=$HAS_PLAYBOOKS"
7676 } >> "$GITHUB_OUTPUT"
77-
77+
7878 echo "Changed roles: $ROLES_JSON"
7979 echo "Changed playbooks: $PLAYBOOKS_JSON"
8080 echo "Combined targets: $TARGETS_JSON"
You can’t perform that action at this time.
0 commit comments