Skip to main content

submit_review

Function submit_review 

Source
pub async fn submit_review(
    base_url: &str,
    owner: &str,
    repo: &str,
    pr_number: u64,
    state: ReviewState,
    message: &str,
    token: &str,
) -> Result<(), RsGuardError>
Expand description

Submits a review to a GitHub Pull Request with automatic permission fallback.

If the initial review state (e.g. APPROVE or REQUEST_CHANGES) fails due to insufficient permissions (HTTP 403), the function retries with COMMENT and prepends [Bot fallback from {state}] to the message.

The base_url is validated against an allowlist before any request is made.

§Arguments

  • base_url — GitHub API base URL (e.g. "https://api.github.com").
  • owner — Repository owner.
  • repo — Repository name.
  • pr_number — Pull request number.
  • state — Desired review state.
  • message — Review body text.
  • token — GitHub authentication token.