Skip to content

Commit 2e3d813

Browse files
committed
Fix workflow output validation warnings
1 parent 581bcbe commit 2e3d813

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

.github/workflows/sync-cloud-run-env.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,18 @@ jobs:
172172
run: |
173173
set -euo pipefail
174174
175+
write_github_output() {
176+
printf '%s\n' "$@" >> "$GITHUB_OUTPUT"
177+
}
178+
175179
deploy_enabled=false
176180
env_sync_enabled=false
177181
178182
if [ "${GITHUB_EVENT_NAME:-}" = "push" ] && [ "${ENABLE_MAIN_PUSH_CLOUD_RUN_AUTOMATION:-}" != "true" ]; then
179-
echo "deploy_enabled=false" >> "$GITHUB_OUTPUT"
180-
echo "env_sync_enabled=false" >> "$GITHUB_OUTPUT"
181-
echo "enabled=false" >> "$GITHUB_OUTPUT"
183+
write_github_output \
184+
"deploy_enabled=false" \
185+
"env_sync_enabled=false" \
186+
"enabled=false"
182187
echo "Skipping Cloud Run automation on push because ENABLE_MAIN_PUSH_CLOUD_RUN_AUTOMATION is not true." >&2
183188
exit 0
184189
fi
@@ -200,16 +205,17 @@ jobs:
200205
fi
201206
fi
202207
203-
echo "deploy_enabled=${deploy_enabled}" >> "$GITHUB_OUTPUT"
204-
echo "env_sync_enabled=${env_sync_enabled}" >> "$GITHUB_OUTPUT"
208+
write_github_output \
209+
"deploy_enabled=${deploy_enabled}" \
210+
"env_sync_enabled=${env_sync_enabled}"
205211
206212
if [ "${deploy_enabled}" != "true" ] && [ "${env_sync_enabled}" != "true" ]; then
207-
echo "enabled=false" >> "$GITHUB_OUTPUT"
213+
write_github_output "enabled=false"
208214
echo "Skipping Cloud Run automation because ENABLE_GITHUB_CLOUD_RUN_DEPLOY and ENABLE_GITHUB_ENV_SYNC are not true." >&2
209215
exit 0
210216
fi
211217
212-
echo "enabled=true" >> "$GITHUB_OUTPUT"
218+
write_github_output "enabled=true"
213219
214220
- name: Checkout repository
215221
if: steps.config.outputs.enabled == 'true'

0 commit comments

Comments
 (0)