-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add workflow to comment on PRs when released #1772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add workflow to comment on PRs when released #1772
Conversation
- Automatically comments on PRs included in a release - Only comments on PRs (not issues) using GitHub API validation - Compares current and previous release tags to find PRs - Minimal permissions: only requires pull-requests:write Fixes modelcontextprotocol#1759
|
Ready for your review @maxisbey |
| const releaseTag = '${{ github.event.release.tag_name }}'; | ||
| const releaseUrl = '${{ github.event.release.html_url }}'; | ||
|
|
||
| const comment = `🎉 This pull request is included in [${releaseTag}](${releaseUrl})!`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No emojis please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
| const prPattern = /#(\d+)/g; | ||
|
|
||
| for (const commit of commits) { | ||
| const message = commit.commit.message; | ||
| const matches = message.matchAll(prPattern); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this Regex which seems like it could find a bunch of false positives (e.g. if it says "Fixes #1234" it would match this), can we use the listPullRequestsAssociatedWithCommit API GH exposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced regex pattern with repos.listPullRequestsAssociatedWithCommit API. Now uses GitHub's official API to get PRs associated with each commit, which eliminates false positives
Motivation and Context
Adds a workflow that automatically comments on PRs when they're included in a release, notifying contributors their changes are live.
Approach
Custom workflow using GitHub's REST API:
Key Features
Only comments on PRs (not issues) - API validation ensures this
Minimal permissions - only
pull-requests: writerequiredHow Has This Been Tested?
Tested with releases v1.23.2 → v1.23.3:
Fixes #1759
Breaking Changes
No, Its an non-breaking change which adds functionality
Types of changes
Checklist