Skip to content

Commit 084f0d0

Browse files
committed
fixes
1 parent 80d841b commit 084f0d0

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/deploy-to-control-plane-review.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
CPLN_ORG: ${{secrets.CPLN_ORG_STAGING}}
1717
CPLN_TOKEN: ${{secrets.CPLN_TOKEN_STAGING}}
1818
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
19-
STATUS_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ github.job_id }}?pr=${{ github.event.pull_request.number || github.event.issue.number }}
19+
STATUS_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ steps.get_job_id.outputs.job_id }}?pr=${{ github.event.pull_request.number || github.event.issue.number }}
2020

2121
jobs:
2222
check-concurrent:
@@ -55,9 +55,27 @@ jobs:
5555
deployment_id: ${{ steps.create-deployment.outputs.result }}
5656

5757
steps:
58+
- name: Get job ID
59+
id: get_job_id
60+
uses: actions/github-script@v7
61+
with:
62+
script: |
63+
const { data: jobs } = await github.rest.actions.listJobsForWorkflowRun({
64+
owner: context.repo.owner,
65+
repo: context.repo.repo,
66+
run_id: context.runId,
67+
});
68+
69+
const currentJob = jobs.jobs.find(job => job.name === context.job);
70+
const jobId = currentJob.id;
71+
72+
return jobId;
73+
5874
- name: Create comment
5975
id: create-comment
6076
uses: actions/github-script@v7
77+
env:
78+
JOB_ID: ${{ steps.get_job_id.outputs.result }}
6179
with:
6280
script: |
6381
async function createComment(message) {
@@ -71,7 +89,7 @@ jobs:
7189
7290
const message = `🚀 Starting new deployment for commit: ${context.sha.substring(0, 7)}
7391
${context.payload.commits ? `\nChanges: ${context.payload.commits[0].message}` : ''}
74-
Status: ${{ env.STATUS_URL }}`;
92+
Status: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/job/${JOB_ID}?pr=${context.issue.number || context.payload.pull_request.number}`;
7593
7694
await createComment(message);
7795

0 commit comments

Comments
 (0)