1. Packages
  2. Github Provider
  3. API Docs
  4. RepositoryPullRequest
GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi

github.RepositoryPullRequest

Explore with Pulumi AI

This resource allows you to create and manage PullRequests for repositories within your GitHub organization or personal account.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const example = new github.RepositoryPullRequest("example", {
    baseRepository: "example-repository",
    baseRef: "main",
    headRef: "feature-branch",
    title: "My newest feature",
    body: "This will change everything",
});
Copy
import pulumi
import pulumi_github as github

example = github.RepositoryPullRequest("example",
    base_repository="example-repository",
    base_ref="main",
    head_ref="feature-branch",
    title="My newest feature",
    body="This will change everything")
Copy
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.NewRepositoryPullRequest(ctx, "example", &github.RepositoryPullRequestArgs{
			BaseRepository: pulumi.String("example-repository"),
			BaseRef:        pulumi.String("main"),
			HeadRef:        pulumi.String("feature-branch"),
			Title:          pulumi.String("My newest feature"),
			Body:           pulumi.String("This will change everything"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;

return await Deployment.RunAsync(() => 
{
    var example = new Github.RepositoryPullRequest("example", new()
    {
        BaseRepository = "example-repository",
        BaseRef = "main",
        HeadRef = "feature-branch",
        Title = "My newest feature",
        Body = "This will change everything",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.RepositoryPullRequest;
import com.pulumi.github.RepositoryPullRequestArgs;
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) {
        var example = new RepositoryPullRequest("example", RepositoryPullRequestArgs.builder()
            .baseRepository("example-repository")
            .baseRef("main")
            .headRef("feature-branch")
            .title("My newest feature")
            .body("This will change everything")
            .build());

    }
}
Copy
resources:
  example:
    type: github:RepositoryPullRequest
    properties:
      baseRepository: example-repository
      baseRef: main
      headRef: feature-branch
      title: My newest feature
      body: This will change everything
Copy

Create RepositoryPullRequest Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RepositoryPullRequest(name: string, args: RepositoryPullRequestArgs, opts?: CustomResourceOptions);
@overload
def RepositoryPullRequest(resource_name: str,
                          args: RepositoryPullRequestArgs,
                          opts: Optional[ResourceOptions] = None)

@overload
def RepositoryPullRequest(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          base_ref: Optional[str] = None,
                          base_repository: Optional[str] = None,
                          head_ref: Optional[str] = None,
                          title: Optional[str] = None,
                          body: Optional[str] = None,
                          maintainer_can_modify: Optional[bool] = None,
                          owner: Optional[str] = None)
func NewRepositoryPullRequest(ctx *Context, name string, args RepositoryPullRequestArgs, opts ...ResourceOption) (*RepositoryPullRequest, error)
public RepositoryPullRequest(string name, RepositoryPullRequestArgs args, CustomResourceOptions? opts = null)
public RepositoryPullRequest(String name, RepositoryPullRequestArgs args)
public RepositoryPullRequest(String name, RepositoryPullRequestArgs args, CustomResourceOptions options)
type: github:RepositoryPullRequest
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RepositoryPullRequestArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RepositoryPullRequestArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryPullRequestArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryPullRequestArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RepositoryPullRequestArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var repositoryPullRequestResource = new Github.RepositoryPullRequest("repositoryPullRequestResource", new()
{
    BaseRef = "string",
    BaseRepository = "string",
    HeadRef = "string",
    Title = "string",
    Body = "string",
    MaintainerCanModify = false,
    Owner = "string",
});
Copy
example, err := github.NewRepositoryPullRequest(ctx, "repositoryPullRequestResource", &github.RepositoryPullRequestArgs{
	BaseRef:             pulumi.String("string"),
	BaseRepository:      pulumi.String("string"),
	HeadRef:             pulumi.String("string"),
	Title:               pulumi.String("string"),
	Body:                pulumi.String("string"),
	MaintainerCanModify: pulumi.Bool(false),
	Owner:               pulumi.String("string"),
})
Copy
var repositoryPullRequestResource = new RepositoryPullRequest("repositoryPullRequestResource", RepositoryPullRequestArgs.builder()
    .baseRef("string")
    .baseRepository("string")
    .headRef("string")
    .title("string")
    .body("string")
    .maintainerCanModify(false)
    .owner("string")
    .build());
Copy
repository_pull_request_resource = github.RepositoryPullRequest("repositoryPullRequestResource",
    base_ref="string",
    base_repository="string",
    head_ref="string",
    title="string",
    body="string",
    maintainer_can_modify=False,
    owner="string")
Copy
const repositoryPullRequestResource = new github.RepositoryPullRequest("repositoryPullRequestResource", {
    baseRef: "string",
    baseRepository: "string",
    headRef: "string",
    title: "string",
    body: "string",
    maintainerCanModify: false,
    owner: "string",
});
Copy
type: github:RepositoryPullRequest
properties:
    baseRef: string
    baseRepository: string
    body: string
    headRef: string
    maintainerCanModify: false
    owner: string
    title: string
Copy

RepositoryPullRequest Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RepositoryPullRequest resource accepts the following input properties:

BaseRef This property is required. string
Name of the branch serving as the base of the Pull Request.
BaseRepository
This property is required.
Changes to this property will trigger replacement.
string
Name of the base repository to retrieve the Pull Requests from.
HeadRef
This property is required.
Changes to this property will trigger replacement.
string
Name of the branch serving as the head of the Pull Request.
Title This property is required. string
The title of the Pull Request.
Body string
Body of the Pull Request.
MaintainerCanModify bool
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
Owner Changes to this property will trigger replacement. string
Owner of the repository. If not provided, the provider's default owner is used.
BaseRef This property is required. string
Name of the branch serving as the base of the Pull Request.
BaseRepository
This property is required.
Changes to this property will trigger replacement.
string
Name of the base repository to retrieve the Pull Requests from.
HeadRef
This property is required.
Changes to this property will trigger replacement.
string
Name of the branch serving as the head of the Pull Request.
Title This property is required. string
The title of the Pull Request.
Body string
Body of the Pull Request.
MaintainerCanModify bool
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
Owner Changes to this property will trigger replacement. string
Owner of the repository. If not provided, the provider's default owner is used.
baseRef This property is required. String
Name of the branch serving as the base of the Pull Request.
baseRepository
This property is required.
Changes to this property will trigger replacement.
String
Name of the base repository to retrieve the Pull Requests from.
headRef
This property is required.
Changes to this property will trigger replacement.
String
Name of the branch serving as the head of the Pull Request.
title This property is required. String
The title of the Pull Request.
body String
Body of the Pull Request.
maintainerCanModify Boolean
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
owner Changes to this property will trigger replacement. String
Owner of the repository. If not provided, the provider's default owner is used.
baseRef This property is required. string
Name of the branch serving as the base of the Pull Request.
baseRepository
This property is required.
Changes to this property will trigger replacement.
string
Name of the base repository to retrieve the Pull Requests from.
headRef
This property is required.
Changes to this property will trigger replacement.
string
Name of the branch serving as the head of the Pull Request.
title This property is required. string
The title of the Pull Request.
body string
Body of the Pull Request.
maintainerCanModify boolean
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
owner Changes to this property will trigger replacement. string
Owner of the repository. If not provided, the provider's default owner is used.
base_ref This property is required. str
Name of the branch serving as the base of the Pull Request.
base_repository
This property is required.
Changes to this property will trigger replacement.
str
Name of the base repository to retrieve the Pull Requests from.
head_ref
This property is required.
Changes to this property will trigger replacement.
str
Name of the branch serving as the head of the Pull Request.
title This property is required. str
The title of the Pull Request.
body str
Body of the Pull Request.
maintainer_can_modify bool
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
owner Changes to this property will trigger replacement. str
Owner of the repository. If not provided, the provider's default owner is used.
baseRef This property is required. String
Name of the branch serving as the base of the Pull Request.
baseRepository
This property is required.
Changes to this property will trigger replacement.
String
Name of the base repository to retrieve the Pull Requests from.
headRef
This property is required.
Changes to this property will trigger replacement.
String
Name of the branch serving as the head of the Pull Request.
title This property is required. String
The title of the Pull Request.
body String
Body of the Pull Request.
maintainerCanModify Boolean
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
owner Changes to this property will trigger replacement. String
Owner of the repository. If not provided, the provider's default owner is used.

Outputs

All input properties are implicitly available as output properties. Additionally, the RepositoryPullRequest resource produces the following output properties:

BaseSha string
Head commit SHA of the Pull Request base.
Draft bool
Indicates Whether this Pull Request is a draft.
HeadSha string
Head commit SHA of the Pull Request head.
Id string
The provider-assigned unique ID for this managed resource.
Labels List<string>
List of label names set on 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
the current Pull Request state - can be "open", "closed" or "merged".
UpdatedAt int
The timestamp of the last Pull Request update.
BaseSha string
Head commit SHA of the Pull Request base.
Draft bool
Indicates Whether this Pull Request is a draft.
HeadSha string
Head commit SHA of the Pull Request head.
Id string
The provider-assigned unique ID for this managed resource.
Labels []string
List of label names set on 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
the current Pull Request state - can be "open", "closed" or "merged".
UpdatedAt int
The timestamp of the last Pull Request update.
baseSha String
Head commit SHA of the Pull Request base.
draft Boolean
Indicates Whether this Pull Request is a draft.
headSha String
Head commit SHA of the Pull Request head.
id String
The provider-assigned unique ID for this managed resource.
labels List<String>
List of label names set on 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
the current Pull Request state - can be "open", "closed" or "merged".
updatedAt Integer
The timestamp of the last Pull Request update.
baseSha string
Head commit SHA of the Pull Request base.
draft boolean
Indicates Whether this Pull Request is a draft.
headSha string
Head commit SHA of the Pull Request head.
id string
The provider-assigned unique ID for this managed resource.
labels string[]
List of label names set on 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
the current Pull Request state - can be "open", "closed" or "merged".
updatedAt number
The timestamp of the last Pull Request update.
base_sha str
Head commit SHA of the Pull Request base.
draft bool
Indicates Whether this Pull Request is a draft.
head_sha str
Head commit SHA of the Pull Request head.
id str
The provider-assigned unique ID for this managed resource.
labels Sequence[str]
List of label names set on 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
the current Pull Request state - can be "open", "closed" or "merged".
updated_at int
The timestamp of the last Pull Request update.
baseSha String
Head commit SHA of the Pull Request base.
draft Boolean
Indicates Whether this Pull Request is a draft.
headSha String
Head commit SHA of the Pull Request head.
id String
The provider-assigned unique ID for this managed resource.
labels List<String>
List of label names set on 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
the current Pull Request state - can be "open", "closed" or "merged".
updatedAt Number
The timestamp of the last Pull Request update.

Look up Existing RepositoryPullRequest Resource

Get an existing RepositoryPullRequest resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RepositoryPullRequestState, opts?: CustomResourceOptions): RepositoryPullRequest
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        base_ref: Optional[str] = None,
        base_repository: Optional[str] = None,
        base_sha: Optional[str] = None,
        body: Optional[str] = None,
        draft: Optional[bool] = None,
        head_ref: Optional[str] = None,
        head_sha: Optional[str] = None,
        labels: Optional[Sequence[str]] = None,
        maintainer_can_modify: Optional[bool] = None,
        number: Optional[int] = None,
        opened_at: Optional[int] = None,
        opened_by: Optional[str] = None,
        owner: Optional[str] = None,
        state: Optional[str] = None,
        title: Optional[str] = None,
        updated_at: Optional[int] = None) -> RepositoryPullRequest
func GetRepositoryPullRequest(ctx *Context, name string, id IDInput, state *RepositoryPullRequestState, opts ...ResourceOption) (*RepositoryPullRequest, error)
public static RepositoryPullRequest Get(string name, Input<string> id, RepositoryPullRequestState? state, CustomResourceOptions? opts = null)
public static RepositoryPullRequest get(String name, Output<String> id, RepositoryPullRequestState state, CustomResourceOptions options)
resources:  _:    type: github:RepositoryPullRequest    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
BaseRef string
Name of the branch serving as the base of the Pull Request.
BaseRepository Changes to this property will trigger replacement. string
Name of the base repository to retrieve the Pull Requests from.
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.
HeadRef Changes to this property will trigger replacement. string
Name of the branch serving as the head of the Pull Request.
HeadSha string
Head commit SHA of the Pull Request head.
Labels List<string>
List of label names set on the Pull Request.
MaintainerCanModify bool
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
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.
Owner Changes to this property will trigger replacement. string
Owner of the repository. If not provided, the provider's default owner is used.
State string
the current Pull Request state - can be "open", "closed" or "merged".
Title string
The title of the Pull Request.
UpdatedAt int
The timestamp of the last Pull Request update.
BaseRef string
Name of the branch serving as the base of the Pull Request.
BaseRepository Changes to this property will trigger replacement. string
Name of the base repository to retrieve the Pull Requests from.
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.
HeadRef Changes to this property will trigger replacement. string
Name of the branch serving as the head of the Pull Request.
HeadSha string
Head commit SHA of the Pull Request head.
Labels []string
List of label names set on the Pull Request.
MaintainerCanModify bool
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
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.
Owner Changes to this property will trigger replacement. string
Owner of the repository. If not provided, the provider's default owner is used.
State string
the current Pull Request state - can be "open", "closed" or "merged".
Title string
The title of the Pull Request.
UpdatedAt int
The timestamp of the last Pull Request update.
baseRef String
Name of the branch serving as the base of the Pull Request.
baseRepository Changes to this property will trigger replacement. String
Name of the base repository to retrieve the Pull Requests from.
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.
headRef Changes to this property will trigger replacement. String
Name of the branch serving as the head of the Pull Request.
headSha String
Head commit SHA of the Pull Request head.
labels List<String>
List of label names set on the Pull Request.
maintainerCanModify Boolean
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
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.
owner Changes to this property will trigger replacement. String
Owner of the repository. If not provided, the provider's default owner is used.
state String
the current Pull Request state - can be "open", "closed" or "merged".
title String
The title of the Pull Request.
updatedAt Integer
The timestamp of the last Pull Request update.
baseRef string
Name of the branch serving as the base of the Pull Request.
baseRepository Changes to this property will trigger replacement. string
Name of the base repository to retrieve the Pull Requests from.
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.
headRef Changes to this property will trigger replacement. string
Name of the branch serving as the head of the Pull Request.
headSha string
Head commit SHA of the Pull Request head.
labels string[]
List of label names set on the Pull Request.
maintainerCanModify boolean
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
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.
owner Changes to this property will trigger replacement. string
Owner of the repository. If not provided, the provider's default owner is used.
state string
the current Pull Request state - can be "open", "closed" or "merged".
title string
The title of the Pull Request.
updatedAt number
The timestamp of the last Pull Request update.
base_ref str
Name of the branch serving as the base of the Pull Request.
base_repository Changes to this property will trigger replacement. str
Name of the base repository to retrieve the Pull Requests from.
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_ref Changes to this property will trigger replacement. str
Name of the branch serving as the head of the Pull Request.
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
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
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.
owner Changes to this property will trigger replacement. str
Owner of the repository. If not provided, the provider's default owner is used.
state str
the current Pull Request state - can be "open", "closed" or "merged".
title str
The title of the Pull Request.
updated_at int
The timestamp of the last Pull Request update.
baseRef String
Name of the branch serving as the base of the Pull Request.
baseRepository Changes to this property will trigger replacement. String
Name of the base repository to retrieve the Pull Requests from.
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.
headRef Changes to this property will trigger replacement. String
Name of the branch serving as the head of the Pull Request.
headSha String
Head commit SHA of the Pull Request head.
labels List<String>
List of label names set on the Pull Request.
maintainerCanModify Boolean
Controls whether the base repository maintainers can modify the Pull Request. Default: false.
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.
owner Changes to this property will trigger replacement. String
Owner of the repository. If not provided, the provider's default owner is used.
state String
the current Pull Request state - can be "open", "closed" or "merged".
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.