|
37 | 37 |
|
38 | 38 | gh pr diff "$PR_NUMBER" > /tmp/diff.txt || echo "No diff available" |
39 | 39 |
|
| 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 | +
|
40 | 65 | - name: Install Cursor CLI |
41 | 66 | shell: bash |
42 | 67 | run: | |
@@ -203,6 +228,7 @@ runs: |
203 | 228 | TYPE: ${{ steps.update.outputs.type }} |
204 | 229 | LOOM_URL: ${{ steps.update.outputs.loom_url }} |
205 | 230 | JIRA_URL: ${{ steps.update.outputs.jira_url }} |
| 231 | + BUILD_ARTIFACT_URL: ${{ steps.artifact.outputs.build_artifact_url }} |
206 | 232 | PR_NUMBER: ${{ inputs.pr-number }} |
207 | 233 | PR_URL: ${{ github.event.pull_request.html_url }} |
208 | 234 | run: | |
@@ -232,6 +258,9 @@ runs: |
232 | 258 | TICKET=$(echo "$JIRA_URL" | grep -oE '[A-Z][A-Z0-9]+-[0-9]+$') |
233 | 259 | FOOTER="${FOOTER} · <${JIRA_URL}|${TICKET}>" |
234 | 260 | fi |
| 261 | + if [ -n "$BUILD_ARTIFACT_URL" ]; then |
| 262 | + FOOTER="${FOOTER} · <${BUILD_ARTIFACT_URL}|Build Artifact>" |
| 263 | + fi |
235 | 264 |
|
236 | 265 | BLOCKS=$(jq -n \ |
237 | 266 | --arg title "$TITLE" \ |
|
0 commit comments