@@ -50,14 +50,42 @@ jobs:
50
50
fetch-depth : 0
51
51
ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || steps.getRef.outputs.PR_REF || github.ref }}
52
52
53
+ - name : Validate Required Secrets
54
+ run : |
55
+ missing_secrets=()
56
+ for secret in "CPLN_TOKEN_STAGING" "CPLN_ORG_STAGING"; do
57
+ if [ -z "${!secret}" ]; then
58
+ missing_secrets+=("$secret")
59
+ fi
60
+ done
61
+
62
+ if [ ${#missing_secrets[@]} -ne 0 ]; then
63
+ echo "❌ Required secrets are not set: ${missing_secrets[*]}"
64
+ exit 1
65
+ fi
66
+
53
67
- name : Setup Environment
54
68
uses : ./.github/actions/setup-environment
55
69
70
+ - name : Set shared functions
71
+ id : shared-functions
72
+ uses : actions/github-script@v7
73
+ with :
74
+ script : |
75
+ core.exportVariable('GET_CONSOLE_LINK', `
76
+ function getConsoleLink(prNumber) {
77
+ return '🎮 [Control Plane Console for Review App with PR #' + prNumber + '](' +
78
+ 'https://console.cpln.io/org/' + process.env.CPLN_ORG + '/workloads/' + process.env.APP_NAME + ')';
79
+ }
80
+ `);
81
+
56
82
- name : Initialize Deployment
57
83
id : init-deployment
58
84
uses : actions/github-script@v7
59
85
with :
60
86
script : |
87
+ eval(process.env.GET_CONSOLE_LINK);
88
+
61
89
async function getWorkflowUrl(runId) {
62
90
// Get the current job ID
63
91
const jobs = await github.rest.actions.listJobsForWorkflowRun({
@@ -117,10 +145,14 @@ jobs:
117
145
uses : actions/github-script@v7
118
146
with :
119
147
script : |
148
+ eval(process.env.GET_CONSOLE_LINK);
149
+
120
150
const buildingMessage = [
121
151
'🏗️ Building Docker image for PR #' + process.env.PR_NUMBER + ', commit ' + '${{ env.COMMIT_HASH }}',
122
152
'',
123
- '[View Build Logs](' + process.env.WORKFLOW_URL + ')'
153
+ '📋 [View Build Logs](' + process.env.WORKFLOW_URL + ')',
154
+ '',
155
+ getConsoleLink(process.env.PR_NUMBER)
124
156
].join('\n');
125
157
126
158
await github.rest.issues.updateComment({
@@ -142,12 +174,16 @@ jobs:
142
174
uses : actions/github-script@v7
143
175
with :
144
176
script : |
177
+ eval(process.env.GET_CONSOLE_LINK);
178
+
145
179
const deployingMessage = [
146
180
'🚀 Deploying to Control Plane...',
147
181
'',
148
182
'⏳ Waiting for deployment to be ready...',
149
183
'',
150
- '[View Deploy Logs](' + process.env.WORKFLOW_URL + ')'
184
+ '📋 [View Deploy Logs](' + process.env.WORKFLOW_URL + ')',
185
+ '',
186
+ getConsoleLink(process.env.PR_NUMBER)
151
187
].join('\n');
152
188
153
189
await github.rest.issues.updateComment({
@@ -168,6 +204,8 @@ jobs:
168
204
uses : actions/github-script@v7
169
205
with :
170
206
script : |
207
+ eval(process.env.GET_CONSOLE_LINK);
208
+
171
209
const prNumber = process.env.PR_NUMBER;
172
210
const appUrl = process.env.REVIEW_APP_URL;
173
211
const workflowUrl = process.env.WORKFLOW_URL;
@@ -192,13 +230,17 @@ jobs:
192
230
'',
193
231
'🚀 [Review App for PR #' + prNumber + '](' + appUrl + ')',
194
232
'',
195
- '📋 [View Completed Action Build and Deploy Logs](' + workflowUrl + ')'
233
+ '📋 [View Completed Action Build and Deploy Logs](' + workflowUrl + ')',
234
+ '',
235
+ getConsoleLink(prNumber)
196
236
].join('\n');
197
237
198
238
const failureMessage = [
199
239
'❌ Deployment failed for PR #' + prNumber + ', commit ' + '${{ env.COMMIT_HASH }}',
200
240
'',
201
- '📋 [View Deployment Logs with Errors](' + workflowUrl + ')'
241
+ '📋 [View Deployment Logs with Errors](' + workflowUrl + ')',
242
+ '',
243
+ getConsoleLink(prNumber)
202
244
].join('\n');
203
245
204
246
// Update the existing comment
0 commit comments