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
| Field | Type | Description |
|---|---|---|
| id | ID! | The ID of the object. |
| createdAt | DateTime! | The time at which the pull request was created. |
| baseBranch | String | The base branch of the pull request. |
| branch | String | The source branch of the pull request. |
| number | Int! | The pull request number. |
| title | String | The title of the pull request. |
| state | PRState! | The current state of the pull request. |
| vcsUrl | String | URL of the pull request on the VCS provider. |
| summary | PRSummary | Summary of issues and vulnerabilities for this pull request. |
| latestAnalysisRun | AnalysisRun | The latest analysis run for this pull request. |
| issueOccurrences | OccurrenceConnection | Issue occurrences in this pull request. |
| offset | Int | Number of items to skip from the beginning of the result set. |
| before | String | Returns items before this cursor. |
| after | String | Returns items after this cursor. |
| first | Int | Returns the first N items. |
| last | Int | Returns the last N items. |
| vulnerabilityOccurrences | VulnerabilityOccurrenceConnection | Vulnerability occurrences in this pull request. |
| offset | Int | Number of items to skip from the beginning of the result set. |
| before | String | Returns items before this cursor. |
| after | String | Returns items after this cursor. |
| first | Int | Returns the first N items. |
| last | Int | Returns the last N items. |
| metrics | [RepositoryMetric!]! | Metrics captured for this pull request. |
PRSummary
Summary of issues and vulnerabilities for a pull request.
| Field | Type | Description |
|---|---|---|
| issuesRaised | Int | Number of issues raised in the pull request. |
| issuesResolved | Int | Number of issues resolved in the pull request. |
| issuesSuppressed | Int | Number of issues suppressed in the pull request. |
| vulnerabilitiesRaised | Int | Number of vulnerabilities raised in the pull request. |
PullRequestConnection
| Field | Type | Description |
|---|---|---|
| pageInfo | PageInfo! | Pagination data for this connection. |
| edges | [PullRequestEdge]! | Contains the nodes in this connection. |
| totalCount | Int | Total number of items in the connection. |
PullRequestEdge
A Relay edge containing a PullRequest and its cursor.
| Field | Type | Description |
|---|---|---|
| node | PullRequest | The item at the end of the edge. |
| cursor | String! | A cursor for use in pagination. |