Skip to content

Update draft release PR comment when release is published #94

@joshjohanning

Description

@joshjohanning

Problem

When create_release_as_draft: true and draft_release_pr_reminder: true, the action posts a comment on the merged PR with a link to the draft release. However, the draft release URL breaks (404s) after the release is published since draft releases use a different URL format. The comment should be updated to reflect the published release with a working link.

Next Steps

  • Review the release notes
  • Publish the release to make it permanent

Solution (implemented in PR #98)

Option 1: Single action, event-type branching — the action checks context.eventName and branches behavior:

  • On push → normal publish flow (existing behavior)
  • On release: [published] → find and update the draft comment, then return early
on:
  push:
    branches: [main]
  release:
    types: [published]

Example: Before (draft)

## 📦 Draft Release Created

A draft release **v3.1.1** has been created for this PR.

🔗 **[View Draft Release](https://github.com/.../releases/tag/untagged-...)**

### Next Steps
- [ ] Review the release notes
- [ ] Publish the release to make it permanent

Example: After (published)

## ✅ Release Published

Release **v3.1.1** has been published!

🔗 **[View Published Release](https://github.com/.../releases/tag/v3.1.1)**

### Next Steps
- [x] Review the release notes
- [x] Publish the release to make it permanent

Implementation Notes

  • Version-specific HTML marker (<!-- publish-github-action-draft:vX.Y.Z -->) for reliable comment matching
  • Legacy fallback for comments without marker (heading + version match)
  • Author filtering to only update our own comments
  • Idempotency: skips if comment already shows published state
  • Predictable tag URL (draft untagged-... URLs 404 after publishing)
  • Uses retryWithBackoff on all API calls
  • 13 tests covering all paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions