Skip to content

Commit 264f072

Browse files
pattonwebzclaude
andcommitted
Let the action post the PR comment
Deletes the local github-script comment step in favour of the action's own sticky comment, using comment-template so the body is unchanged. The action can now render the artifact download link itself - it exposes the artifact ID it already fetches while verifying the artifact exists - so the local step's separate listWorkflowRunArtifacts call is redundant. Behaviour change: the comment is now sticky, updating one comment in place instead of posting a new one per build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019LoLgW7oFjBPxGea9kiZJ2
1 parent ea0fc9a commit 264f072

1 file changed

Lines changed: 8 additions & 37 deletions

File tree

.github/workflows/build-plugin-with-ref.yml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ jobs:
265265
artifact-name: ${{ env.PRIMARY_ZIP_NAME_NO_EXT }}
266266
plugin-slug: accessibility-checker
267267
github-token: ${{ secrets.GITHUB_TOKEN }}
268+
post-comment: ${{ github.event_name == 'pull_request' }}
269+
pr-number: ${{ github.event.pull_request.number }}
270+
comment-template: |
271+
✅ Accessibility Checker build (primary only)
272+
273+
- **Artifact**: [Download {artifact_name}.zip]({artifact_url})
274+
- **Workflow run**: [View logs]({run_url})
275+
- **Playground (primary)**: [Open with plugin preinstalled]({playground_url})
268276
269277
- name: Upload to release (both zips)
270278
if: github.event_name == 'release'
@@ -277,43 +285,6 @@ jobs:
277285
env:
278286
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
279287

280-
- name: Comment on PR with primary build details
281-
if: github.event_name == 'pull_request'
282-
uses: actions/github-script@v7
283-
env:
284-
PRIMARY_PLAYGROUND_URL: ${{ steps.playground_primary.outputs.playground-url }}
285-
with:
286-
script: |
287-
const prNumber = context.payload.pull_request.number;
288-
const runId = context.runId;
289-
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`;
290-
const primaryName = process.env.PRIMARY_ZIP_NAME_NO_EXT;
291-
292-
// Get the artifact ID for the download URL
293-
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
294-
owner: context.repo.owner,
295-
repo: context.repo.repo,
296-
run_id: runId,
297-
});
298-
299-
const artifact = artifacts.data.artifacts.find(a => a.name === primaryName);
300-
const downloadUrl = artifact
301-
? `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}/artifacts/${artifact.id}`
302-
: runUrl;
303-
304-
const primaryPlaygroundUrl = process.env.PRIMARY_PLAYGROUND_URL;
305-
const primaryPlaygroundLine = primaryPlaygroundUrl
306-
? `\n- **Playground (primary)**: [Open with plugin preinstalled](${primaryPlaygroundUrl})`
307-
: `\n- **Playground (primary)**: Not available for this run.`;
308-
309-
const body = `✅ Accessibility Checker build (primary only)\n\n- **Artifact**: [Download ${primaryName}.zip](${downloadUrl})\n- **Workflow run**: [View logs](${runUrl})${primaryPlaygroundLine}`;
310-
await github.rest.issues.createComment({
311-
owner: context.repo.owner,
312-
repo: context.repo.repo,
313-
issue_number: prNumber,
314-
body,
315-
});
316-
317288
- name: Remove triggering label from PR
318289
if: github.event_name == 'pull_request'
319290
uses: actions/github-script@v7

0 commit comments

Comments
 (0)