Skip to content

Commit a7b270c

Browse files
annab1cursoragent
andcommitted
feat: Add build artifact link to Slack pulse footer
Adds a "Get build artifact link" step that looks up the most recent successful run of the caller repo's Build workflow (build.yml) for the PR's head SHA, resolves its uploaded artifact, and appends a "Build Artifact" link to the Slack notification footer alongside the PR # and Jira ticket links. Skips gracefully if no matching run or artifact is found. Ref: ED-24831 Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 10c5106 commit a7b270c

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

actions/product-pulse/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,31 @@ runs:
3737
3838
gh pr diff "$PR_NUMBER" > /tmp/diff.txt || echo "No diff available"
3939
40+
- name: Get build artifact link
41+
id: artifact
42+
shell: bash
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
REPO: ${{ github.repository }}
46+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
47+
run: |
48+
RUN_ID=$(gh api "repos/${REPO}/actions/workflows/build.yml/runs?head_sha=${HEAD_SHA}&status=success" --jq '.workflow_runs[0].id // empty' 2>/dev/null || echo "")
49+
50+
if [ -z "$RUN_ID" ]; then
51+
echo "⚠️ No successful Build workflow run found for this PR, skipping artifact link"
52+
exit 0
53+
fi
54+
55+
ARTIFACT_ID=$(gh api "repos/${REPO}/actions/runs/${RUN_ID}/artifacts" --jq '.artifacts[0].id // empty' 2>/dev/null || echo "")
56+
57+
if [ -z "$ARTIFACT_ID" ]; then
58+
echo "⚠️ No build artifact found for run $RUN_ID, skipping artifact link"
59+
exit 0
60+
fi
61+
62+
echo "🔗 Found build artifact: https://github.com/${REPO}/actions/runs/${RUN_ID}/artifacts/${ARTIFACT_ID}"
63+
echo "build_artifact_url=https://github.com/${REPO}/actions/runs/${RUN_ID}/artifacts/${ARTIFACT_ID}" >> $GITHUB_OUTPUT
64+
4065
- name: Install Cursor CLI
4166
shell: bash
4267
run: |
@@ -203,6 +228,7 @@ runs:
203228
TYPE: ${{ steps.update.outputs.type }}
204229
LOOM_URL: ${{ steps.update.outputs.loom_url }}
205230
JIRA_URL: ${{ steps.update.outputs.jira_url }}
231+
BUILD_ARTIFACT_URL: ${{ steps.artifact.outputs.build_artifact_url }}
206232
PR_NUMBER: ${{ inputs.pr-number }}
207233
PR_URL: ${{ github.event.pull_request.html_url }}
208234
run: |
@@ -232,6 +258,9 @@ runs:
232258
TICKET=$(echo "$JIRA_URL" | grep -oE '[A-Z][A-Z0-9]+-[0-9]+$')
233259
FOOTER="${FOOTER} · <${JIRA_URL}|${TICKET}>"
234260
fi
261+
if [ -n "$BUILD_ARTIFACT_URL" ]; then
262+
FOOTER="${FOOTER} · <${BUILD_ARTIFACT_URL}|Build Artifact>"
263+
fi
235264
236265
BLOCKS=$(jq -n \
237266
--arg title "$TITLE" \

0 commit comments

Comments
 (0)