Pull request

Query for pull request data associated with a repository, including analysis results and metrics.

Query pull request analysis results, including issues raised/resolved and vulnerability findings. Access pull requests via repository { pullRequest(number: ...) { ... } }.

Fetching a pull request

Query:repository:pullRequest Fetch the details of a pull request by its number.

Sample Request

query (
  $name: String!
  $login: String!
  $vcsProvider: VCSProvider!
  $number: Int!
) {
  repository(name: $name, login: $login, vcsProvider: $vcsProvider) {
    pullRequest(number: $number) {
      id
      number
      title
      state
      baseBranch
      branch
      vcsUrl
      createdAt
      summary {
        issuesRaised
        issuesResolved
        issuesSuppressed
        vulnerabilitiesRaised
      }
      latestAnalysisRun {
        id
        status
        summary {
          occurrencesIntroduced
          occurrencesResolved
        }
      }
    }
  }
}

Sample Response

{
  "data": {
    "repository": {
      "pullRequest": {
        "id": "UFVsbFJlcXVlc3Q6eHl6",
        "number": 42,
        "title": "Fix authentication bug",
        "state": "OPEN",
        "baseBranch": "main",
        "branch": "fix/auth-bug",
        "vcsUrl": "https://github.com/acme/repo/pull/42",
        "createdAt": "2024-03-15T10:30:00Z",
        "summary": {
          "issuesRaised": 2,
          "issuesResolved": 5,
          "issuesSuppressed": 0,
          "vulnerabilitiesRaised": 0
        },
        "latestAnalysisRun": {
          "id": "QW5hbHlzaXNSdW46YWJj",
          "status": "SUCCESS",
          "summary": {
            "occurrencesIntroduced": 2,
            "occurrencesResolved": 5
          }
        }
      }
    }
  }
}

Objects

PullRequest

FieldTypeDescription
idID!The ID of the object.
createdAtDateTime!The time at which the pull request was created.
baseBranchStringThe base branch of the pull request.
branchStringThe source branch of the pull request.
numberInt!The pull request number.
titleStringThe title of the pull request.
statePRState!The current state of the pull request.
vcsUrlStringURL of the pull request on the VCS provider.
summaryPRSummarySummary of issues and vulnerabilities for this pull request.
latestAnalysisRunAnalysisRunThe latest analysis run for this pull request.
issueOccurrencesOccurrenceConnectionIssue occurrences in this pull request.
offsetIntNumber of items to skip from the beginning of the result set.
beforeStringReturns items before this cursor.
afterStringReturns items after this cursor.
firstIntReturns the first N items.
lastIntReturns the last N items.
vulnerabilityOccurrencesVulnerabilityOccurrenceConnectionVulnerability occurrences in this pull request.
offsetIntNumber of items to skip from the beginning of the result set.
beforeStringReturns items before this cursor.
afterStringReturns items after this cursor.
firstIntReturns the first N items.
lastIntReturns the last N items.
metrics[RepositoryMetric!]!Metrics captured for this pull request.

PRSummary

Summary of issues and vulnerabilities for a pull request.

FieldTypeDescription
issuesRaisedIntNumber of issues raised in the pull request.
issuesResolvedIntNumber of issues resolved in the pull request.
issuesSuppressedIntNumber of issues suppressed in the pull request.
vulnerabilitiesRaisedIntNumber of vulnerabilities raised in the pull request.

PullRequestConnection

FieldTypeDescription
pageInfoPageInfo!Pagination data for this connection.
edges[PullRequestEdge]!Contains the nodes in this connection.
totalCountIntTotal number of items in the connection.

PullRequestEdge

A Relay edge containing a PullRequest and its cursor.

FieldTypeDescription
nodePullRequestThe item at the end of the edge.
cursorString!A cursor for use in pagination.

On this page