Skip to content

Commit 6451848

Browse files
authored
Surface promote workflow run URL from CLI and PR (DataDog#23563)
* Surface promote workflow run URL from CLI and PR - `ddev dep promote` now prints a recent-runs URL filtered to workflow_dispatch events. - `dependency-wheel-promotion.yaml` sets a per-run `run-name` containing the PR number, attaches a `target_url` to the success/error commit statuses, and includes the run URL in the success comment so reviewers can jump straight to the run. * Add ddev changelog entry * Collapse runs_url f-string to satisfy ruff format
1 parent b648cd5 commit 6451848

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/dependency-wheel-promotion.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Dependency Wheel Promotion
2+
run-name: "Promote wheels for PR #${{ inputs.pr_number }} (${{ github.actor }})"
23

34
on:
45
workflow_dispatch:
@@ -70,17 +71,19 @@ jobs:
7071
state: 'success',
7172
context: 'dependency-wheel-promotion',
7273
description: 'Wheels promoted to stable storage.',
74+
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
7375
});
7476
7577
- name: Post success comment
7678
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
7779
with:
7880
script: |
81+
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
7982
await github.rest.issues.createComment({
8083
owner: context.repo.owner,
8184
repo: context.repo.repo,
8285
issue_number: ${{ inputs.pr_number }},
83-
body: `Wheels promoted to stable storage for commit ${{ inputs.head_sha }} by @${context.actor}.`,
86+
body: `Wheels promoted to stable storage for commit ${{ inputs.head_sha }} by @${context.actor}. [Workflow run](${runUrl}).`,
8487
});
8588
8689
- name: Set dependency-wheel-promotion status to error
@@ -95,4 +98,5 @@ jobs:
9598
state: 'error',
9699
context: 'dependency-wheel-promotion',
97100
description: 'Wheel promotion failed. Check the Actions tab for details.',
101+
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
98102
});

ddev/changelog.d/23563.added

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`ddev dep promote` now prints a link to the dependency-wheel-promotion workflow's recent runs page after dispatching, so users can jump straight to their queued run.

ddev/src/ddev/cli/dep/promote.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,8 @@ def promote(app: Application, pr_url: str):
5151
inputs={'pr_number': str(pr_number), 'head_sha': head_sha},
5252
)
5353

54-
app.display_success(f'Promote workflow dispatched for PR #{pr_number}. Check the Actions tab for progress.')
54+
runs_url = (
55+
f'https://github.com/{app.github.repo_id}/actions/workflows/{PROMOTE_WORKFLOW}?query=event%3Aworkflow_dispatch'
56+
)
57+
app.display_success(f'Promote workflow dispatched for PR #{pr_number}.')
58+
app.display_info(f'Recent runs: {runs_url}')

0 commit comments

Comments
 (0)