Skip to content

Commit fb24c23

Browse files
synleclaude
andcommitted
ci: add PR comment with build artifact download links
On pull requests, after all platform builds complete, post a comment with a table of artifact names, sizes, and download links. Updates the same comment on subsequent pushes to the PR (uses HTML marker to find existing comment). Follows the same pattern as sqlui-native. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 274a104 commit fb24c23

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,59 @@ jobs:
104104
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
105105
compression-level: 9
106106
if-no-files-found: ignore
107+
108+
# Post a comment on PRs with download links for each platform's build artifacts
109+
pr_comment:
110+
if: github.event_name == 'pull_request'
111+
needs: [build]
112+
runs-on: ubuntu-latest
113+
permissions:
114+
pull-requests: write
115+
steps:
116+
- name: Post artifact links on PR
117+
uses: actions/github-script@v7
118+
with:
119+
script: |
120+
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
121+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
122+
owner: context.repo.owner,
123+
repo: context.repo.repo,
124+
run_id: context.runId,
125+
});
126+
let body = `## Build Artifacts\n\n`;
127+
if (artifacts.data.artifacts.length === 0) {
128+
body += `No artifacts were produced.\n`;
129+
} else {
130+
body += `| Platform | Size | Download |\n|----------|------|----------|\n`;
131+
for (const a of artifacts.data.artifacts) {
132+
const sizeMB = (a.size_in_bytes / 1024 / 1024).toFixed(1);
133+
const downloadUrl = `${runUrl}/artifacts/${a.id}`;
134+
body += `| ${a.name} | ${sizeMB} MB | [Download](${downloadUrl}) |\n`;
135+
}
136+
}
137+
body += `\n[View full run](${runUrl})`;
138+
139+
// Find and update existing comment or create new one
140+
const marker = '<!-- build-artifacts -->';
141+
body = marker + '\n' + body;
142+
const { data: comments } = await github.rest.issues.listComments({
143+
owner: context.repo.owner,
144+
repo: context.repo.repo,
145+
issue_number: context.issue.number,
146+
});
147+
const existing = comments.find(c => c.body.includes(marker));
148+
if (existing) {
149+
await github.rest.issues.updateComment({
150+
owner: context.repo.owner,
151+
repo: context.repo.repo,
152+
comment_id: existing.id,
153+
body,
154+
});
155+
} else {
156+
await github.rest.issues.createComment({
157+
owner: context.repo.owner,
158+
repo: context.repo.repo,
159+
issue_number: context.issue.number,
160+
body,
161+
});
162+
}

0 commit comments

Comments
 (0)