@@ -113,10 +113,10 @@ jobs:
113
113
env :
114
114
DEBIAN_FRONTEND : noninteractive
115
115
run : |
116
- sudo apt update && \
117
- sudo apt install -y software-properties-common && \
118
- sudo apt-add-repository ppa:ansible/ansible -y && \
119
- sudo apt install -y ansible
116
+ sudo apt update && \
117
+ sudo apt install -y software-properties-common && \
118
+ sudo apt-add-repository ppa:ansible/ansible -y && \
119
+ sudo apt install -y ansible
120
120
121
121
# NOTE (@NickLarsenNZ): This could be removed in favor of nix-shell and rrbutani/use-nix-shell-action
122
122
- name : Install deps for operators
@@ -159,25 +159,13 @@ jobs:
159
159
# For debugging
160
160
cat config/repositories.yaml
161
161
162
- # Generate PRs
163
162
- name : Run playbook
164
- if : ${{ !inputs.dry-run }}
165
163
env :
166
164
CUSTOM_PR_TITLE : ${{ inputs.custom-pr-title }}
167
165
GH_ACCESS_TOKEN : ${{ secrets.gh_access_token }}
166
+ # --tags local excludes all actions that actually generate PRs
167
+ DRY_RUN_FLAGS : ${{ inputs.dry-run && "--tags local" || "" }}
168
168
run : |
169
169
# Funnel via JSON to ensure that values are escaped properly
170
- # Check if custom PR title is set. If so, insert it into the extra vars
171
- if [ -n "$CUSTOM_PR_TITLE" ]; then
172
- echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, custom_pr_title: $ENV.CUSTOM_PR_TITLE, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN}' --arg pwd "$(pwd)" > vars.json
173
- else
174
- echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN}' --arg pwd "$(pwd)" > vars.json
175
- fi
176
- ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json"
177
-
178
- # Do Not Generate PRs
179
- - name : Run playbook (dry-run)
180
- if : ${{ inputs.dry-run }}
181
- run : ./test.sh
182
- env :
183
- GH_ACCESS_TOKEN : " "
170
+ echo '{}' | jq '{commit_hash: $ENV.GITHUB_SHA, author: $ENV.AUTHOR, reason: $ENV.REASON, custom_pr_title: $ENV.CUSTOM_PR_TITLE, base_dir: $pwd, gh_access_token: $ENV.GH_ACCESS_TOKEN} | with_entries(select(.value != null and .value != ""))' --arg pwd "$(pwd)" > vars.json
171
+ ansible-playbook playbook/playbook.yaml --extra-vars "@vars.json" $DRY_RUN_FLAGS
0 commit comments