Skip to content

Fix preview deployment comments in workflow_run triggered jobs - #34

Merged
rhingo merged 1 commit into
aplbrain:mainfrom
CodyCBakerPhD:claude/fix-preview-comment
Sep 25, 2026
Merged

rhingo merged 1 commit into
aplbrain:mainfrom
CodyCBakerPhD:claude/fix-preview-comment

Conversation

@CodyCBakerPhD

Copy link
Copy Markdown
Contributor

Summary

This change fixes preview deployment URL comments not appearing on pull requests when the deployment is triggered via workflow_run events. The issue stems from the pr-preview-action's built-in comment functionality being unable to resolve the pull request number from the workflow_run event payload.

Key Changes

  • Disabled the pr-preview-action's automatic comment generation by setting comment: false
  • Added explicit pull request number to the deploy commit message using the previously extracted PR number from steps.pr.outputs.number
  • Introduced a new step using marocchino/sticky-pull-request-comment@v2 to post the preview URL comment with:
    • Explicit PR number passed via the number input (required for workflow_run events)
    • Informative message including the preview URL and deployment details
    • Header identifier for sticky comment management

Implementation Details

The root cause is that workflow_run event payloads don't include pull request context, so the original action's sticky comment logic fails when trying to auto-resolve the PR number. By explicitly passing steps.pr.outputs.number (extracted in a previous step) to the comment action, we ensure the comment is posted to the correct pull request regardless of the trigger event type.

https://claude.ai/code/session_015KZdA347fHh4xxpdHkVwxQ

The preview for PR 33 deployed correctly but no comment appeared on the
pull request. pr-preview-action posts its sticky comment by calling
marocchino/sticky-pull-request-comment without a `number`, which makes
that action resolve the pull request from the event payload. A
workflow_run payload contains no pull request, so it had nothing to
comment on. The action's `pr-number` input only feeds the deploy path,
not the comment.

The same blank context showed up in the deploy commit, which read
"Deploy preview for PR  🛫" because the default message interpolates
github.event.number.

Disable the action's own comment and post it from a dedicated step that
passes the validated number explicitly, and set deploy-commit-message so
the commit names the pull request. Both are annotated so the next reader
does not collapse them back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KZdA347fHh4xxpdHkVwxQ
@rhingo
rhingo merged commit b53f4fa into aplbrain:main Sep 25, 2026
3 checks passed
@CodyCBakerPhD
CodyCBakerPhD deleted the claude/fix-preview-comment branch September 25, 2026 18:02
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.

3 participants