Skip to content

github: add GitHub API function to submit pull request reviews - #343

Merged
obelisk merged 4 commits into
obelisk:mainfrom
nvsriram:github/add-approve-pr
Jul 20, 2026
Merged

github: add GitHub API function to submit pull request reviews#343
obelisk merged 4 commits into
obelisk:mainfrom
nvsriram:github/add-approve-pr

Conversation

@nvsriram

@nvsriram nvsriram commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR introduces a new GitHub API function that enables Plaid modules to submit a review on a pull request.

Changes

  • STL: Added PullRequestReviewEvent enum, SubmitPullRequestReviewRequest struct, submit_pull_request_review, and approve_pull_request wrapper in runtime/plaid-stl/src/github/pull_request.rs.
  • Runtime: Implemented submit_pull_request_review method in the GitHub API handler in runtime/plaid/src/apis/github/pull_requests.rs
  • Validation: Added validate_review_body in runtime/plaid/src/apis/github/validators.rs to ensure non-empty body is provided when event is RequestChanges or Comment
  • Function Registration: Added function mapping and implementation in runtime/plaid/src/functions/api.rs

Rationale

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}/reviews with caller-specified event and body.

@michelemin michelemin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I would expand the API a bit and double check the POST body. Then we can ship it 🙂

Comment thread runtime/plaid-stl/src/github/pull_request.rs Outdated
Comment thread runtime/plaid/src/apis/github/pull_requests.rs Outdated
Comment thread runtime/plaid/src/apis/github/pull_requests.rs Outdated
Comment thread runtime/plaid/src/apis/github/pull_requests.rs Outdated
@michelemin
michelemin marked this pull request as ready for review July 20, 2026 16:37
Copilot AI review requested due to automatic review settings July 20, 2026 16:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ApprovePullRequestRequest plus a new approve_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}/reviews with event: "APPROVE" (and optional body).
  • 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.

Comment thread runtime/plaid/src/apis/github/pull_requests.rs
@obelisk obelisk added enhancement New feature or request API Relating to the API subsystems AI Prompted The code was primarily generated via prompts. Using AI code complete, does not count. labels Jul 20, 2026
@nvsriram nvsriram changed the title github: add GitHub API function to approve pull requests github: add GitHub API function to submit pull request reviews Jul 20, 2026

@michelemin michelemin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@obelisk
obelisk merged commit c3a21a0 into obelisk:main Jul 20, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Prompted The code was primarily generated via prompts. Using AI code complete, does not count. API Relating to the API subsystems enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants