Skip to content

Action: one sticky PR comment, opt-in comment: true - #94

Merged
tmashara merged 2 commits into
mainfrom
claude/issue-44-sticky-comment
Oct 29, 2026
Merged

tmashara merged 2 commits into
mainfrom
claude/issue-44-sticky-comment

Conversation

@tmashara

Copy link
Copy Markdown
Owner

What / why

New comment input (default "false"). With comment: "true" the action posts the verdict, the left/right line, links to the run and the artifact, and the compact output as one PR comment, and edits that same comment on every later run instead of stacking new ones. The comment starts with <!-- renderdiff:<artifact-name> -->, so two runs in one job (which already need distinct artifact-names) keep separate comments. Output over 60 000 bytes is cut on a line boundary (no split UTF-8, fence always closes) with a link to the full job summary.

Permissions

The job needs pull-requests: write (documented with a permissions: block in docs/github-action.md). Uses the default github.token and gh, preinstalled on GitHub-hosted runners.

Behaviour

  • pull_request: comments on that PR.
  • deployment_status: looks up the open PR for the deployed commit (commits/{sha}/pulls, open only).
  • push / no open PR: notice, comment skipped.
  • Fork or Dependabot PR (read-only token), missing gh, any API error: a warning; the step never fails the job, and the result stays in the job summary. Docs warn against switching to pull_request_target.
  • Existing comment is matched only if authored by github-actions[bot] and starting with the marker, so a human quoting it isn't edited.

Self-test

.github/workflows/action.yml sets RENDERDIFF_COMMENT_DRY_RUN=1 for the job (an undocumented test hook) and runs the differ case with comment: "true": it builds the body and does the read-only lookup of existing comments, then prints the POST/PATCH it would send. The final check asserts the body file has the marker and /color.

Tested locally

  • bash -n on the extracted step scripts (shellcheck not installed).
  • Ran the comment step with fake RUNNER_TEMP/GITHUB_* env: push with no PR (notice, exit 0); deployment_status on main's merge sha (merged PR ignored, skipped); dry run against PR Release 0.10.0 #90 (read-only GET, prints POST .../issues/90/comments); bad token (warning, exit 0); a 2000-line multibyte log (body 60 196 bytes, valid UTF-8, fence closed on its own line, truncation note); small log with artifact URL.
  • Ran the run step on the bad-input path: job summary output unchanged.
  • npm run typecheck, lint, format:check, npm test, npm run test:visual pass.

Fixes #44

🤖 Generated with Claude Code

tmashara and others added 2 commits October 29, 2026 20:36
Posts the verdict and compact output as one PR comment, found by a
per-artifact-name marker and edited on later runs. Works on pull_request
and deployment_status; warns instead of failing on a read-only token.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tmashara
tmashara merged commit b423781 into main Oct 29, 2026
3 checks passed
@tmashara
tmashara deleted the claude/issue-44-sticky-comment branch October 29, 2026 19:49
@tmashara tmashara mentioned this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Action: one sticky PR comment with the result

1 participant