Skip to content

Commit 79ecc5d

Browse files
committed
Expose the wheel as an artifact
1 parent b140429 commit 79ecc5d

File tree

2 files changed

+71
-30
lines changed

2 files changed

+71
-30
lines changed

.github/workflows/comment-pr.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/continuous-integration.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,74 @@ jobs:
152152
run: unzip -l dist/*.whl | grep -q itables_for_dash/async-ITable.js.LICENSE.txt
153153
- name: Check LICENSE.txt in sdist
154154
run: tar -tvf dist/*.tar.gz | grep -q itables_for_dash/async-ITable.js.LICENSE.txt
155+
156+
# Upload the wheel as an artifact
157+
- name: Upload wheel artifact
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: itables-wheel
161+
path: dist/*.whl
162+
163+
# Comment on PR with artifact link (only on PRs)
164+
- name: Comment with direct artifact link
165+
if: github.event_name == 'pull_request'
166+
uses: actions/github-script@v7
167+
with:
168+
script: |
169+
const pr_number = context.payload.pull_request.number;
170+
const run_id = context.runId;
171+
const marker = '<!-- itables-artifact-link -->';
172+
173+
// List artifacts for this run
174+
const { data: { artifacts } } = await github.rest.actions.listWorkflowRunArtifacts({
175+
owner: context.repo.owner,
176+
repo: context.repo.repo,
177+
run_id: run_id,
178+
});
179+
180+
// Find the artifact named 'itables-wheel'
181+
const artifact = artifacts.find(a => a.name === 'itables-wheel');
182+
let artifact_url;
183+
if (artifact) {
184+
artifact_url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${run_id}/artifacts/${artifact.id}`;
185+
} else {
186+
artifact_url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${run_id}#artifacts`;
187+
}
188+
189+
const body = `${marker}
190+
Thank you for making this pull request.
191+
192+
Did you know? You can try it on Binder: [![Binder:lab](https://img.shields.io/badge/binder-jupyterlab-0172B2.svg)](https://mybinder.org/v2/gh/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.ref }}?urlpath=lab/tree/docs/quick_start.md).
193+
194+
Also, the version of ITables developed in this PR is available as a wheel artifact :package: for easy installation.
195+
Download it [here](${artifact_url}), unzip it and then run <code>pip install itables-xxx.whl</code> in the unzipped directory.`;
196+
197+
// List comments on the PR
198+
const { data: comments } = await github.rest.issues.listComments({
199+
owner: context.repo.owner,
200+
repo: context.repo.repo,
201+
issue_number: pr_number,
202+
});
203+
204+
// Find existing comment by this workflow (by marker)
205+
const existing = comments.find(
206+
c => c.user.type === 'Bot' && c.body && c.body.includes(marker)
207+
);
208+
209+
if (existing) {
210+
// Update the existing comment
211+
await github.rest.issues.updateComment({
212+
owner: context.repo.owner,
213+
repo: context.repo.repo,
214+
comment_id: existing.id,
215+
body,
216+
});
217+
} else {
218+
// Create a new comment
219+
await github.rest.issues.createComment({
220+
owner: context.repo.owner,
221+
repo: context.repo.repo,
222+
issue_number: pr_number,
223+
body,
224+
});
225+
}

0 commit comments

Comments
 (0)