1. Packages
  2. GitHub
  3. API Docs
  4. getRepositoryPullRequests
GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi

github.getRepositoryPullRequests

Explore with Pulumi AI

github logo
GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi

    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:

    BaseRepository string
    Name of the base repository to retrieve the Pull Requests from.
    BaseRef string
    If set, filters Pull Requests by base branch name.
    HeadRef 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.
    SortBy 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".
    SortDirection 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".
    BaseRepository string
    Name of the base repository to retrieve the Pull Requests from.
    BaseRef string
    If set, filters Pull Requests by base branch name.
    HeadRef 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.
    SortBy 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".
    SortDirection 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".
    baseRepository String
    Name of the base repository to retrieve the Pull Requests from.
    baseRef String
    If set, filters Pull Requests by base branch name.
    headRef 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.
    sortBy 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".
    sortDirection 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".
    baseRepository string
    Name of the base repository to retrieve the Pull Requests from.
    baseRef string
    If set, filters Pull Requests by base branch name.
    headRef 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.
    sortBy 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".
    sortDirection 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".
    baseRepository String
    Name of the base repository to retrieve the Pull Requests from.
    baseRef String
    If set, filters Pull Requests by base branch name.
    headRef 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.
    sortBy 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".
    sortDirection 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:

    BaseRepository string
    Id string
    The provider-assigned unique ID for this managed resource.
    Results List<GetRepositoryPullRequestsResult>
    Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
    BaseRef string
    Name of the ref (branch) of the Pull Request base.
    HeadRef string
    Value of the Pull Request HEAD reference.
    Owner string
    SortBy string
    SortDirection string
    State string
    the current Pull Request state - can be "open", "closed" or "merged".
    BaseRepository string
    Id string
    The provider-assigned unique ID for this managed resource.
    Results []GetRepositoryPullRequestsResult
    Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
    BaseRef string
    Name of the ref (branch) of the Pull Request base.
    HeadRef string
    Value of the Pull Request HEAD reference.
    Owner string
    SortBy string
    SortDirection string
    State string
    the current Pull Request state - can be "open", "closed" or "merged".
    baseRepository String
    id String
    The provider-assigned unique ID for this managed resource.
    results List<GetRepositoryPullRequestsResult>
    Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
    baseRef String
    Name of the ref (branch) of the Pull Request base.
    headRef String
    Value of the Pull Request HEAD reference.
    owner String
    sortBy String
    sortDirection String
    state String
    the current Pull Request state - can be "open", "closed" or "merged".
    baseRepository string
    id string
    The provider-assigned unique ID for this managed resource.
    results GetRepositoryPullRequestsResult[]
    Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme:
    baseRef string
    Name of the ref (branch) of the Pull Request base.
    headRef string
    Value of the Pull Request HEAD reference.
    owner string
    sortBy string
    sortDirection 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[GetRepositoryPullRequestsResult]
    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".
    baseRepository 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:
    baseRef String
    Name of the ref (branch) of the Pull Request base.
    headRef String
    Value of the Pull Request HEAD reference.
    owner String
    sortBy String
    sortDirection String
    state String
    the current Pull Request state - can be "open", "closed" or "merged".

    Supporting Types

    GetRepositoryPullRequestsResult

    BaseRef string
    If set, filters Pull Requests by base branch name.
    BaseSha 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.
    HeadOwner string
    Owner of the Pull Request head repository.
    HeadRef 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".
    HeadRepository string
    Name of the Pull Request head repository.
    HeadSha string
    Head commit SHA of the Pull Request head.
    Labels List<string>
    List of label names set on the Pull Request.
    MaintainerCanModify bool
    Indicates whether the base repository maintainers can modify the Pull Request.
    Number int
    The number of the Pull Request within the repository.
    OpenedAt int
    Unix timestamp indicating the Pull Request creation time.
    OpenedBy 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.
    UpdatedAt int
    The timestamp of the last Pull Request update.
    BaseRef string
    If set, filters Pull Requests by base branch name.
    BaseSha 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.
    HeadOwner string
    Owner of the Pull Request head repository.
    HeadRef 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".
    HeadRepository string
    Name of the Pull Request head repository.
    HeadSha string
    Head commit SHA of the Pull Request head.
    Labels []string
    List of label names set on the Pull Request.
    MaintainerCanModify bool
    Indicates whether the base repository maintainers can modify the Pull Request.
    Number int
    The number of the Pull Request within the repository.
    OpenedAt int
    Unix timestamp indicating the Pull Request creation time.
    OpenedBy 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.
    UpdatedAt int
    The timestamp of the last Pull Request update.
    baseRef String
    If set, filters Pull Requests by base branch name.
    baseSha 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.
    headOwner String
    Owner of the Pull Request head repository.
    headRef 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".
    headRepository String
    Name of the Pull Request head repository.
    headSha String
    Head commit SHA of the Pull Request head.
    labels List<String>
    List of label names set on the Pull Request.
    maintainerCanModify Boolean
    Indicates whether the base repository maintainers can modify the Pull Request.
    number Integer
    The number of the Pull Request within the repository.
    openedAt Integer
    Unix timestamp indicating the Pull Request creation time.
    openedBy 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.
    updatedAt Integer
    The timestamp of the last Pull Request update.
    baseRef string
    If set, filters Pull Requests by base branch name.
    baseSha 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.
    headOwner string
    Owner of the Pull Request head repository.
    headRef 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".
    headRepository string
    Name of the Pull Request head repository.
    headSha string
    Head commit SHA of the Pull Request head.
    labels string[]
    List of label names set on the Pull Request.
    maintainerCanModify boolean
    Indicates whether the base repository maintainers can modify the Pull Request.
    number number
    The number of the Pull Request within the repository.
    openedAt number
    Unix timestamp indicating the Pull Request creation time.
    openedBy 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.
    updatedAt 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_modify bool
    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.
    baseRef String
    If set, filters Pull Requests by base branch name.
    baseSha 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.
    headOwner String
    Owner of the Pull Request head repository.
    headRef 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".
    headRepository String
    Name of the Pull Request head repository.
    headSha String
    Head commit SHA of the Pull Request head.
    labels List<String>
    List of label names set on the Pull Request.
    maintainerCanModify Boolean
    Indicates whether the base repository maintainers can modify the Pull Request.
    number Number
    The number of the Pull Request within the repository.
    openedAt Number
    Unix timestamp indicating the Pull Request creation time.
    openedBy 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.
    updatedAt 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.
    github logo
    GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi