github: add GitHub API function to submit pull request reviews - #343
Merged
Conversation
michelemin
requested changes
Jul 20, 2026
michelemin
left a comment
Collaborator
There was a problem hiding this comment.
Looks good! I would expand the API a bit and double check the POST body. Then we can ship it 🙂
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new GitHub API capability to Plaid so modules can approve a pull request by creating a PR review with the APPROVE event via GitHub’s Pull Request Reviews REST API.
Changes:
- Added
ApprovePullRequestRequestplus a newapprove_pull_request(...)STL helper to call the host function and return the created review JSON. - Implemented the runtime GitHub API handler method that POSTs to
/repos/{owner}/{repo}/pulls/{number}/reviewswithevent: "APPROVE"(and optionalbody). - Registered the new host function and mapped
"github_approve_pull_request"to the runtime implementation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| runtime/plaid/src/functions/api.rs | Registers and exposes the new github_approve_pull_request host function to modules. |
| runtime/plaid/src/apis/github/pull_requests.rs | Implements the runtime POST call to create an approval review for a PR. |
| runtime/plaid-stl/src/github/pull_request.rs | Adds request struct + STL wrapper function for approving PRs and returning raw JSON. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new GitHub API function that enables Plaid modules to submit a review on a pull request.
Changes
PullRequestReviewEventenum,SubmitPullRequestReviewRequeststruct,submit_pull_request_review, andapprove_pull_requestwrapper inruntime/plaid-stl/src/github/pull_request.rs.submit_pull_request_reviewmethod in the GitHub API handler inruntime/plaid/src/apis/github/pull_requests.rsvalidate_review_bodyinruntime/plaid/src/apis/github/validators.rsto ensure non-emptybodyis provided wheneventisRequestChangesorCommentruntime/plaid/src/functions/api.rsRationale
This functionality is needed to enable automated approval of pull requests from Plaid modules. The implementation uses the GitHub Pull Request Reviews API endpoint
/repos/{owner}/{repo}/pulls/{number}/reviewswith caller-specifiedeventandbody.