GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi
github.getRepositoryPullRequests
Explore with Pulumi AI
Use this data source to retrieve information about multiple GitHub Pull Requests in a repository.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = github.getRepositoryPullRequests({
baseRepository: "example-repository",
baseRef: "main",
sortBy: "updated",
sortDirection: "desc",
state: "open",
});
import pulumi
import pulumi_github as github
example = github.get_repository_pull_requests(base_repository="example-repository",
base_ref="main",
sort_by="updated",
sort_direction="desc",
state="open")
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := github.LookupRepositoryPullRequests(ctx, &github.LookupRepositoryPullRequestsArgs{
BaseRepository: "example-repository",
BaseRef: pulumi.StringRef("main"),
SortBy: pulumi.StringRef("updated"),
SortDirection: pulumi.StringRef("desc"),
State: pulumi.StringRef("open"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = Github.GetRepositoryPullRequests.Invoke(new()
{
BaseRepository = "example-repository",
BaseRef = "main",
SortBy = "updated",
SortDirection = "desc",
State = "open",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.GithubFunctions;
import com.pulumi.github.inputs.GetRepositoryPullRequestsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = GithubFunctions.getRepositoryPullRequests(GetRepositoryPullRequestsArgs.builder()
.baseRepository("example-repository")
.baseRef("main")
.sortBy("updated")
.sortDirection("desc")
.state("open")
.build());
}
}
variables:
example:
fn::invoke:
Function: github:getRepositoryPullRequests
Arguments:
baseRepository: example-repository
baseRef: main
sortBy: updated
sortDirection: desc
state: open
Using getRepositoryPullRequests
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRepositoryPullRequests(args: GetRepositoryPullRequestsArgs, opts?: InvokeOptions): Promise<GetRepositoryPullRequestsResult>
function getRepositoryPullRequestsOutput(args: GetRepositoryPullRequestsOutputArgs, opts?: InvokeOptions): Output<GetRepositoryPullRequestsResult>
def get_repository_pull_requests(base_ref: Optional[str] = None,
base_repository: Optional[str] = None,
head_ref: Optional[str] = None,
owner: Optional[str] = None,
sort_by: Optional[str] = None,
sort_direction: Optional[str] = None,
state: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRepositoryPullRequestsResult
def get_repository_pull_requests_output(base_ref: Optional[pulumi.Input[str]] = None,
base_repository: Optional[pulumi.Input[str]] = None,
head_ref: Optional[pulumi.Input[str]] = None,
owner: Optional[pulumi.Input[str]] = None,
sort_by: Optional[pulumi.Input[str]] = None,
sort_direction: Optional[pulumi.Input[str]] = None,
state: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRepositoryPullRequestsResult]
func LookupRepositoryPullRequests(ctx *Context, args *LookupRepositoryPullRequestsArgs, opts ...InvokeOption) (*LookupRepositoryPullRequestsResult, error)
func LookupRepositoryPullRequestsOutput(ctx *Context, args *LookupRepositoryPullRequestsOutputArgs, opts ...InvokeOption) LookupRepositoryPullRequestsResultOutput
> Note: This function is named LookupRepositoryPullRequests
in the Go SDK.
public static class GetRepositoryPullRequests
{
public static Task<GetRepositoryPullRequestsResult> InvokeAsync(GetRepositoryPullRequestsArgs args, InvokeOptions? opts = null)
public static Output<GetRepositoryPullRequestsResult> Invoke(GetRepositoryPullRequestsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetRepositoryPullRequestsResult> getRepositoryPullRequests(GetRepositoryPullRequestsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: github:index/getRepositoryPullRequests:getRepositoryPullRequests
arguments:
# arguments dictionary
The following arguments are supported:
- Base
Repository string - Name of the base repository to retrieve the Pull Requests from.
- Base
Ref string - If set, filters Pull Requests by base branch name.
- Head
Ref string - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- Owner string
- Owner of the repository. If not provided, the provider's default owner is used.
- Sort
By string - If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created".
- Sort
Direction string - If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc".
- State string
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- Base
Repository string - Name of the base repository to retrieve the Pull Requests from.
- Base
Ref string - If set, filters Pull Requests by base branch name.
- Head
Ref string - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- Owner string
- Owner of the repository. If not provided, the provider's default owner is used.
- Sort
By string - If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created".
- Sort
Direction string - If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc".
- State string
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- base
Repository String - Name of the base repository to retrieve the Pull Requests from.
- base
Ref String - If set, filters Pull Requests by base branch name.
- head
Ref String - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- owner String
- Owner of the repository. If not provided, the provider's default owner is used.
- sort
By String - If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created".
- sort
Direction String - If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc".
- state String
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- base
Repository string - Name of the base repository to retrieve the Pull Requests from.
- base
Ref string - If set, filters Pull Requests by base branch name.
- head
Ref string - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- owner string
- Owner of the repository. If not provided, the provider's default owner is used.
- sort
By string - If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created".
- sort
Direction string - If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc".
- state string
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- base_
repository str - Name of the base repository to retrieve the Pull Requests from.
- base_
ref str - If set, filters Pull Requests by base branch name.
- head_
ref str - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- owner str
- Owner of the repository. If not provided, the provider's default owner is used.
- sort_
by str - If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created".
- sort_
direction str - If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc".
- state str
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- base
Repository String - Name of the base repository to retrieve the Pull Requests from.
- base
Ref String - If set, filters Pull Requests by base branch name.
- head
Ref String - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- owner String
- Owner of the repository. If not provided, the provider's default owner is used.
- sort
By String - If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created".
- sort
Direction String - If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc".
- state String
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
getRepositoryPullRequests Result
The following output properties are available:
- Base
Repository string - Id string
- The provider-assigned unique ID for this managed resource.
- Results
List<Get
Repository Pull Requests Result> - Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
- Base
Ref string - Name of the ref (branch) of the Pull Request base.
- Head
Ref string - Value of the Pull Request
HEAD
reference. - Owner string
- Sort
By string - Sort
Direction string - State string
- the current Pull Request state - can be "open", "closed" or "merged".
- Base
Repository string - Id string
- The provider-assigned unique ID for this managed resource.
- Results
[]Get
Repository Pull Requests Result - Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
- Base
Ref string - Name of the ref (branch) of the Pull Request base.
- Head
Ref string - Value of the Pull Request
HEAD
reference. - Owner string
- Sort
By string - Sort
Direction string - State string
- the current Pull Request state - can be "open", "closed" or "merged".
- base
Repository String - id String
- The provider-assigned unique ID for this managed resource.
- results
List<Get
Repository Pull Requests Result> - Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
- base
Ref String - Name of the ref (branch) of the Pull Request base.
- head
Ref String - Value of the Pull Request
HEAD
reference. - owner String
- sort
By String - sort
Direction String - state String
- the current Pull Request state - can be "open", "closed" or "merged".
- base
Repository string - id string
- The provider-assigned unique ID for this managed resource.
- results
Get
Repository Pull Requests Result[] - Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
- base
Ref string - Name of the ref (branch) of the Pull Request base.
- head
Ref string - Value of the Pull Request
HEAD
reference. - owner string
- sort
By string - sort
Direction string - state string
- the current Pull Request state - can be "open", "closed" or "merged".
- base_
repository str - id str
- The provider-assigned unique ID for this managed resource.
- results
Sequence[Get
Repository Pull Requests Result] - Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
- base_
ref str - Name of the ref (branch) of the Pull Request base.
- head_
ref str - Value of the Pull Request
HEAD
reference. - owner str
- sort_
by str - sort_
direction str - state str
- the current Pull Request state - can be "open", "closed" or "merged".
- base
Repository String - id String
- The provider-assigned unique ID for this managed resource.
- results List<Property Map>
- Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
- base
Ref String - Name of the ref (branch) of the Pull Request base.
- head
Ref String - Value of the Pull Request
HEAD
reference. - owner String
- sort
By String - sort
Direction String - state String
- the current Pull Request state - can be "open", "closed" or "merged".
Supporting Types
GetRepositoryPullRequestsResult
- Base
Ref string - If set, filters Pull Requests by base branch name.
- Base
Sha string - Head commit SHA of the Pull Request base.
- Body string
- Body of the Pull Request.
- Draft bool
- Indicates Whether this Pull Request is a draft.
- Head
Owner string - Owner of the Pull Request head repository.
- Head
Ref string - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- Head
Repository string - Name of the Pull Request head repository.
- Head
Sha string - Head commit SHA of the Pull Request head.
- Labels List<string>
- List of label names set on the Pull Request.
- Maintainer
Can boolModify - Indicates whether the base repository maintainers can modify the Pull Request.
- Number int
- The number of the Pull Request within the repository.
- Opened
At int - Unix timestamp indicating the Pull Request creation time.
- Opened
By string - GitHub login of the user who opened the Pull Request.
- State string
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- Title string
- The title of the Pull Request.
- Updated
At int - The timestamp of the last Pull Request update.
- Base
Ref string - If set, filters Pull Requests by base branch name.
- Base
Sha string - Head commit SHA of the Pull Request base.
- Body string
- Body of the Pull Request.
- Draft bool
- Indicates Whether this Pull Request is a draft.
- Head
Owner string - Owner of the Pull Request head repository.
- Head
Ref string - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- Head
Repository string - Name of the Pull Request head repository.
- Head
Sha string - Head commit SHA of the Pull Request head.
- Labels []string
- List of label names set on the Pull Request.
- Maintainer
Can boolModify - Indicates whether the base repository maintainers can modify the Pull Request.
- Number int
- The number of the Pull Request within the repository.
- Opened
At int - Unix timestamp indicating the Pull Request creation time.
- Opened
By string - GitHub login of the user who opened the Pull Request.
- State string
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- Title string
- The title of the Pull Request.
- Updated
At int - The timestamp of the last Pull Request update.
- base
Ref String - If set, filters Pull Requests by base branch name.
- base
Sha String - Head commit SHA of the Pull Request base.
- body String
- Body of the Pull Request.
- draft Boolean
- Indicates Whether this Pull Request is a draft.
- head
Owner String - Owner of the Pull Request head repository.
- head
Ref String - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- head
Repository String - Name of the Pull Request head repository.
- head
Sha String - Head commit SHA of the Pull Request head.
- labels List<String>
- List of label names set on the Pull Request.
- maintainer
Can BooleanModify - Indicates whether the base repository maintainers can modify the Pull Request.
- number Integer
- The number of the Pull Request within the repository.
- opened
At Integer - Unix timestamp indicating the Pull Request creation time.
- opened
By String - GitHub login of the user who opened the Pull Request.
- state String
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- title String
- The title of the Pull Request.
- updated
At Integer - The timestamp of the last Pull Request update.
- base
Ref string - If set, filters Pull Requests by base branch name.
- base
Sha string - Head commit SHA of the Pull Request base.
- body string
- Body of the Pull Request.
- draft boolean
- Indicates Whether this Pull Request is a draft.
- head
Owner string - Owner of the Pull Request head repository.
- head
Ref string - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- head
Repository string - Name of the Pull Request head repository.
- head
Sha string - Head commit SHA of the Pull Request head.
- labels string[]
- List of label names set on the Pull Request.
- maintainer
Can booleanModify - Indicates whether the base repository maintainers can modify the Pull Request.
- number number
- The number of the Pull Request within the repository.
- opened
At number - Unix timestamp indicating the Pull Request creation time.
- opened
By string - GitHub login of the user who opened the Pull Request.
- state string
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- title string
- The title of the Pull Request.
- updated
At number - The timestamp of the last Pull Request update.
- base_
ref str - If set, filters Pull Requests by base branch name.
- base_
sha str - Head commit SHA of the Pull Request base.
- body str
- Body of the Pull Request.
- draft bool
- Indicates Whether this Pull Request is a draft.
- head_
owner str - Owner of the Pull Request head repository.
- head_
ref str - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- head_
repository str - Name of the Pull Request head repository.
- head_
sha str - Head commit SHA of the Pull Request head.
- labels Sequence[str]
- List of label names set on the Pull Request.
- maintainer_
can_ boolmodify - Indicates whether the base repository maintainers can modify the Pull Request.
- number int
- The number of the Pull Request within the repository.
- opened_
at int - Unix timestamp indicating the Pull Request creation time.
- opened_
by str - GitHub login of the user who opened the Pull Request.
- state str
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- title str
- The title of the Pull Request.
- updated_
at int - The timestamp of the last Pull Request update.
- base
Ref String - If set, filters Pull Requests by base branch name.
- base
Sha String - Head commit SHA of the Pull Request base.
- body String
- Body of the Pull Request.
- draft Boolean
- Indicates Whether this Pull Request is a draft.
- head
Owner String - Owner of the Pull Request head repository.
- head
Ref String - If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch".
- head
Repository String - Name of the Pull Request head repository.
- head
Sha String - Head commit SHA of the Pull Request head.
- labels List<String>
- List of label names set on the Pull Request.
- maintainer
Can BooleanModify - Indicates whether the base repository maintainers can modify the Pull Request.
- number Number
- The number of the Pull Request within the repository.
- opened
At Number - Unix timestamp indicating the Pull Request creation time.
- opened
By String - GitHub login of the user who opened the Pull Request.
- state String
- If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open".
- title String
- The title of the Pull Request.
- updated
At Number - The timestamp of the last Pull Request update.
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
github
Terraform Provider.