@@ -50,14 +50,42 @@ jobs:
5050 fetch-depth : 0
5151 ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || steps.getRef.outputs.PR_REF || github.ref }}
5252
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+
5367 - name : Setup Environment
5468 uses : ./.github/actions/setup-environment
5569
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+
5682 - name : Initialize Deployment
5783 id : init-deployment
5884 uses : actions/github-script@v7
5985 with :
6086 script : |
87+ eval(process.env.GET_CONSOLE_LINK);
88+
6189 async function getWorkflowUrl(runId) {
6290 // Get the current job ID
6391 const jobs = await github.rest.actions.listJobsForWorkflowRun({
@@ -117,10 +145,14 @@ jobs:
117145 uses : actions/github-script@v7
118146 with :
119147 script : |
148+ eval(process.env.GET_CONSOLE_LINK);
149+
120150 const buildingMessage = [
121151 '🏗️ Building Docker image for PR #' + process.env.PR_NUMBER + ', commit ' + '${{ env.COMMIT_HASH }}',
122152 '',
123- '[View Build Logs](' + process.env.WORKFLOW_URL + ')'
153+ '📋 [View Build Logs](' + process.env.WORKFLOW_URL + ')',
154+ '',
155+ getConsoleLink(process.env.PR_NUMBER)
124156 ].join('\n');
125157
126158 await github.rest.issues.updateComment({
@@ -142,12 +174,16 @@ jobs:
142174 uses : actions/github-script@v7
143175 with :
144176 script : |
177+ eval(process.env.GET_CONSOLE_LINK);
178+
145179 const deployingMessage = [
146180 '🚀 Deploying to Control Plane...',
147181 '',
148182 '⏳ Waiting for deployment to be ready...',
149183 '',
150- '[View Deploy Logs](' + process.env.WORKFLOW_URL + ')'
184+ '📋 [View Deploy Logs](' + process.env.WORKFLOW_URL + ')',
185+ '',
186+ getConsoleLink(process.env.PR_NUMBER)
151187 ].join('\n');
152188
153189 await github.rest.issues.updateComment({
@@ -168,6 +204,8 @@ jobs:
168204 uses : actions/github-script@v7
169205 with :
170206 script : |
207+ eval(process.env.GET_CONSOLE_LINK);
208+
171209 const prNumber = process.env.PR_NUMBER;
172210 const appUrl = process.env.REVIEW_APP_URL;
173211 const workflowUrl = process.env.WORKFLOW_URL;
@@ -192,13 +230,17 @@ jobs:
192230 '',
193231 '🚀 [Review App for PR #' + prNumber + '](' + appUrl + ')',
194232 '',
195- '📋 [View Completed Action Build and Deploy Logs](' + workflowUrl + ')'
233+ '📋 [View Completed Action Build and Deploy Logs](' + workflowUrl + ')',
234+ '',
235+ getConsoleLink(prNumber)
196236 ].join('\n');
197237
198238 const failureMessage = [
199239 '❌ Deployment failed for PR #' + prNumber + ', commit ' + '${{ env.COMMIT_HASH }}',
200240 '',
201- '📋 [View Deployment Logs with Errors](' + workflowUrl + ')'
241+ '📋 [View Deployment Logs with Errors](' + workflowUrl + ')',
242+ '',
243+ getConsoleLink(prNumber)
202244 ].join('\n');
203245
204246 // Update the existing comment
0 commit comments