Skip to content

Commit f13a45f

Browse files
committed
Address generated workflow review follow-ups
1 parent 4428ec4 commit f13a45f

3 files changed

Lines changed: 22 additions & 11 deletions

File tree

.github/actions/cpflow-delete-control-plane-app/delete-app.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ if ! exists_output="$(cpflow exists -a "$APP_NAME" --org "$CPLN_ORG" 2>&1)"; the
4040
esac
4141

4242
if [[ -n "$exists_output" ]]; then
43-
printf '%s\n' "$exists_output"
43+
echo "⚠️ cpflow exists returned non-zero output that did not match known error patterns:" >&2
44+
printf '%s\n' "$exists_output" >&2
4445
fi
4546

4647
echo "⚠️ Application does not exist: $APP_NAME"

.github/workflows/cpflow-cleanup-stale-review-apps.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ jobs:
4545
cpflow_version: ${{ vars.CPFLOW_VERSION }}
4646

4747
- name: Remove stale review apps
48+
env:
49+
CPLN_ORG_STAGING: ${{ vars.CPLN_ORG_STAGING }}
50+
REVIEW_APP_PREFIX: ${{ vars.REVIEW_APP_PREFIX }}
4851
shell: bash
4952
run: |
5053
set -euo pipefail
51-
cpflow cleanup-stale-apps -a "${{ vars.REVIEW_APP_PREFIX }}" --org "${{ vars.CPLN_ORG_STAGING }}" --yes
54+
cpflow cleanup-stale-apps -a "${REVIEW_APP_PREFIX}" --org "${CPLN_ORG_STAGING}" --yes

.github/workflows/cpflow-deploy-review-app.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,27 @@ jobs:
7373
id: resolve-pr
7474
env:
7575
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
EVENT_NAME: ${{ github.event_name }}
77+
DISPATCH_PR_NUMBER: ${{ github.event.inputs.pr_number }}
78+
COMMENT_PR_NUMBER: ${{ github.event.issue.number }}
79+
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
80+
REVIEW_APP_PREFIX: ${{ vars.REVIEW_APP_PREFIX }}
7681
shell: bash
7782
run: |
7883
set -euo pipefail
7984
80-
case "${{ github.event_name }}" in
85+
case "${EVENT_NAME}" in
8186
workflow_dispatch)
82-
pr_number="${{ github.event.inputs.pr_number }}"
87+
pr_number="${DISPATCH_PR_NUMBER}"
8388
;;
8489
issue_comment)
85-
pr_number="${{ github.event.issue.number }}"
90+
pr_number="${COMMENT_PR_NUMBER}"
8691
;;
8792
pull_request)
88-
pr_number="${{ github.event.pull_request.number }}"
93+
pr_number="${PULL_REQUEST_NUMBER}"
8994
;;
9095
*)
91-
echo "Unsupported event type: ${{ github.event_name }}" >&2
96+
echo "Unsupported event type: ${EVENT_NAME}" >&2
9297
exit 1
9398
;;
9499
esac
@@ -104,7 +109,7 @@ jobs:
104109
105110
{
106111
echo "PR_NUMBER=$pr_number"
107-
echo "APP_NAME=${{ vars.REVIEW_APP_PREFIX }}-$pr_number"
112+
echo "APP_NAME=${REVIEW_APP_PREFIX}-$pr_number"
108113
echo "PR_SHA=$pr_sha"
109114
} >> "$GITHUB_ENV"
110115
echo "same_repo=${same_repo}" >> "$GITHUB_OUTPUT"
@@ -114,16 +119,18 @@ jobs:
114119
id: source
115120
env:
116121
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
EVENT_NAME: ${{ github.event_name }}
123+
SAME_REPO: ${{ steps.resolve-pr.outputs.same_repo }}
117124
shell: bash
118125
run: |
119126
set -euo pipefail
120127
121-
if [[ "${{ steps.resolve-pr.outputs.same_repo }}" == "true" ]]; then
128+
if [[ "${SAME_REPO}" == "true" ]]; then
122129
echo "allowed=true" >> "$GITHUB_OUTPUT"
123130
exit 0
124131
fi
125132
126-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
133+
if [[ "${EVENT_NAME}" == "pull_request" ]]; then
127134
echo "allowed=false" >> "$GITHUB_OUTPUT"
128135
{
129136
echo "Review app deploys are skipped for fork pull requests."
@@ -133,7 +140,7 @@ jobs:
133140
fi
134141
135142
message="Review app deploys from fork pull requests are not allowed because this workflow uses repository secrets."
136-
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
143+
if [[ "${EVENT_NAME}" == "issue_comment" ]]; then
137144
if ! gh pr comment "${PR_NUMBER}" --body "${message}"; then
138145
echo "Failed to post fork rejection comment to PR #${PR_NUMBER}" >&2
139146
fi

0 commit comments

Comments
 (0)