Skip to content

Commit 3b13adb

Browse files
committed
Regenerate cpflow GitHub Actions
1 parent 2edde37 commit 3b13adb

7 files changed

Lines changed: 42 additions & 27 deletions

File tree

.github/actions/cpflow-build-docker-image/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ runs:
5252
chmod 700 ~/.ssh
5353
5454
if [[ -n "${DOCKER_BUILD_SSH_KNOWN_HOSTS}" ]]; then
55-
printf '%s\n' "${DOCKER_BUILD_SSH_KNOWN_HOSTS}" | tr -d '\r' > ~/.ssh/known_hosts
55+
printf '%s\n' "${DOCKER_BUILD_SSH_KNOWN_HOSTS}" > ~/.ssh/known_hosts
5656
else
5757
printf '%s\n' \
5858
'github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl' \
@@ -62,7 +62,7 @@ runs:
6262
fi
6363
chmod 600 ~/.ssh/known_hosts
6464
65-
printf '%s\n' "${DOCKER_BUILD_SSH_KEY}" | tr -d '\r' > ~/.ssh/cpflow_build_key
65+
printf '%s\n' "${DOCKER_BUILD_SSH_KEY}" > ~/.ssh/cpflow_build_key
6666
chmod 600 ~/.ssh/cpflow_build_key
6767
6868
- name: Build Docker image

.github/actions/cpflow-setup-environment/action.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,22 @@ inputs:
1414
from .ruby-version, .tool-versions, or the Gemfile.
1515
required: false
1616
default: ""
17+
# GitHub parses double-brace expression snippets inside action metadata (including
18+
# `description:`) while loading the composite action, and the `vars` context is not
19+
# available in that phase. Keep these descriptions in plain prose - reference repo
20+
# variables by NAME only, never with literal GitHub Actions expression syntax.
1721
cpln_cli_version:
1822
description: >-
19-
@controlplane/cli version. Empty string falls back to the action's pinned default
20-
so callers can pass `${{ vars.CPLN_CLI_VERSION }}` unconditionally.
23+
@controlplane/cli version. Empty string falls back to the action's pinned default,
24+
so callers can wire this input to the CPLN_CLI_VERSION repository variable
25+
unconditionally.
2126
required: false
2227
default: ""
2328
cpflow_version:
2429
description: >-
25-
cpflow gem version. Empty string falls back to the action's pinned default
26-
so callers can pass `${{ vars.CPFLOW_VERSION }}` unconditionally.
30+
cpflow gem version. Empty string falls back to the action's pinned default,
31+
so callers can wire this input to the CPFLOW_VERSION repository variable
32+
unconditionally.
2733
required: false
2834
default: ""
2935

.github/actions/cpflow-wait-for-health/action.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,12 @@ runs:
6161
for attempt in $(seq 1 "${CPFLOW_MAX_RETRIES}"); do
6262
echo "Health check attempt ${attempt}/${CPFLOW_MAX_RETRIES}"
6363
64-
workload_stderr="$(mktemp)"
65-
if ! workload_json="$(cpln workload get "${CPFLOW_WORKLOAD_NAME}" --gvc "${CPFLOW_APP_NAME}" --org "${CPFLOW_ORG}" -o json 2>"${workload_stderr}")"; then
64+
if ! workload_json="$(cpln workload get "${CPFLOW_WORKLOAD_NAME}" --gvc "${CPFLOW_APP_NAME}" --org "${CPFLOW_ORG}" -o json 2>&1)"; then
6665
echo "::error::Workload '${CPFLOW_WORKLOAD_NAME}' not found in GVC '${CPFLOW_APP_NAME}'. Set PRIMARY_WORKLOAD to the correct workload name." >&2
67-
cat "${workload_stderr}" >&2
68-
rm -f "${workload_stderr}"
66+
printf '%s\n' "${workload_json}" >&2
6967
echo "healthy=false" >> "$GITHUB_OUTPUT"
7068
exit 1
7169
fi
72-
rm -f "${workload_stderr}"
7370
7471
endpoint="$(echo "${workload_json}" | jq -r '.status.endpoint // empty')"
7572
if [[ -n "${endpoint}" ]]; then

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,18 @@ jobs:
113113
cpln_org: ${{ vars.CPLN_ORG_STAGING }}
114114
review_app_prefix: ${{ vars.REVIEW_APP_PREFIX }}
115115

116+
# Finalizer still runs after delete failures, but only after config validation
117+
# created the initial PR comment and workflow link env vars it updates.
116118
- name: Finalize delete status
117119
if: always() && steps.config.outputs.ready == 'true'
118120
uses: actions/github-script@v7
121+
env:
122+
COMMENT_ID: ${{ steps.create-comment.outputs.comment-id }}
123+
JOB_STATUS: ${{ job.status }}
119124
with:
120125
script: |
121-
const commentId = Number("${{ steps.create-comment.outputs.comment-id }}");
122-
const success = "${{ job.status }}" === "success";
126+
const commentId = Number(process.env.COMMENT_ID);
127+
const success = process.env.JOB_STATUS === "success";
123128
const body = success
124129
? [
125130
`✅ Review app for PR #${process.env.PR_NUMBER} is deleted`,

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,9 @@ jobs:
119119
same_repo="true"
120120
fi
121121
122-
{
123-
echo "PR_NUMBER=$pr_number"
124-
echo "APP_NAME=${REVIEW_APP_PREFIX}-$pr_number"
125-
echo "PR_SHA=$pr_sha"
126-
} >> "$GITHUB_ENV"
122+
echo "PR_NUMBER=$pr_number" >> "$GITHUB_ENV"
123+
echo "APP_NAME=${REVIEW_APP_PREFIX}-$pr_number" >> "$GITHUB_ENV"
124+
echo "PR_SHA=$pr_sha" >> "$GITHUB_ENV"
127125
echo "same_repo=${same_repo}" >> "$GITHUB_OUTPUT"
128126
129127
- name: Validate review app deployment source
@@ -305,9 +303,11 @@ jobs:
305303
- name: Update PR comment with build status
306304
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
307305
uses: actions/github-script@v7
306+
env:
307+
COMMENT_ID: ${{ steps.create-comment.outputs.comment-id }}
308308
with:
309309
script: |
310-
const commentId = Number("${{ steps.create-comment.outputs.comment-id }}");
310+
const commentId = Number(process.env.COMMENT_ID);
311311
if (!Number.isFinite(commentId) || commentId <= 0) {
312312
core.warning("Skipping PR comment update because no comment id was created.");
313313
return;
@@ -344,9 +344,11 @@ jobs:
344344
- name: Update PR comment with deploy status
345345
if: steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
346346
uses: actions/github-script@v7
347+
env:
348+
COMMENT_ID: ${{ steps.create-comment.outputs.comment-id }}
347349
with:
348350
script: |
349-
const commentId = Number("${{ steps.create-comment.outputs.comment-id }}");
351+
const commentId = Number(process.env.COMMENT_ID);
350352
if (!Number.isFinite(commentId) || commentId <= 0) {
351353
core.warning("Skipping PR comment update because no comment id was created.");
352354
return;
@@ -398,12 +400,17 @@ jobs:
398400
- name: Finalize deployment status
399401
if: always() && steps.config.outputs.ready == 'true' && steps.source.outputs.allowed == 'true' && (steps.check-app.outputs.exists == 'true' || steps.setup-review-app.outcome == 'success')
400402
uses: actions/github-script@v7
403+
env:
404+
COMMENT_ID: ${{ steps.create-comment.outputs.comment-id }}
405+
DEPLOYMENT_ID: ${{ steps.init-deployment.outputs.result }}
406+
APP_URL: ${{ steps.workload.outputs.workload_url }}
407+
JOB_STATUS: ${{ job.status }}
401408
with:
402409
script: |
403-
const commentId = Number("${{ steps.create-comment.outputs.comment-id }}");
404-
const deploymentId = "${{ steps.init-deployment.outputs.result }}";
405-
const appUrl = "${{ steps.workload.outputs.workload_url }}";
406-
const success = "${{ job.status }}" === "success";
410+
const commentId = Number(process.env.COMMENT_ID);
411+
const deploymentId = process.env.DEPLOYMENT_ID;
412+
const appUrl = process.env.APP_URL;
413+
const success = process.env.JOB_STATUS === "success";
407414
408415
if (deploymentId) {
409416
await github.rest.repos.createDeploymentStatus({

.github/workflows/cpflow-deploy-staging.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ jobs:
5656
- name: Checkout repository
5757
if: steps.check-branch.outputs.is_deployable == 'true'
5858
uses: actions/checkout@v4
59+
with:
60+
persist-credentials: false
5961

6062
- name: Validate required secrets and variables
6163
if: steps.check-branch.outputs.is_deployable == 'true'

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ jobs:
2828
const body = [
2929
"# Review app commands",
3030
"",
31-
"Repo owners, members, and collaborators can use these commands:",
32-
"",
3331
"- `+review-app-deploy` - create or redeploy this PR's review app.",
3432
"- `+review-app-delete` - delete this PR's review app and temporary resources.",
3533
"- `+review-app-help` - show setup details and workflow behavior.",
3634
"",
37-
"For setup details, repo owners, members, and collaborators can comment `+review-app-help`."
35+
"For setup details, comment `+review-app-help`."
3836
].join("\n");
3937
4038
await github.rest.issues.createComment({

0 commit comments

Comments
 (0)