Repository Args
This resource allows you to create and manage repositories within your GitHub organization or personal account.
Note When used with GitHub App authentication, even GET requests must have the
contents:write
permission. Without it, the following arguments will be ignored, leading to unexpected behavior and confusing diffs:allow_merge_commit
,allow_squash_merge
,allow_rebase_merge
,merge_commit_title
,merge_commit_message
,squash_merge_commit_title
andsquash_merge_commit_message
.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = new github.Repository("example", {
name: "example",
description: "My awesome codebase",
visibility: "public",
template: {
owner: "github",
repository: "terraform-template-module",
includeAllBranches: true,
},
});
import pulumi
import pulumi_github as github
example = github.Repository("example",
name="example",
description="My awesome codebase",
visibility="public",
template={
"owner": "github",
"repository": "terraform-template-module",
"include_all_branches": True,
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = new Github.Repository("example", new()
{
Name = "example",
Description = "My awesome codebase",
Visibility = "public",
Template = new Github.Inputs.RepositoryTemplateArgs
{
Owner = "github",
Repository = "terraform-template-module",
IncludeAllBranches = true,
},
});
});
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.NewRepository(ctx, "example", &github.RepositoryArgs{
Name: pulumi.String("example"),
Description: pulumi.String("My awesome codebase"),
Visibility: pulumi.String("public"),
Template: &github.RepositoryTemplateArgs{
Owner: pulumi.String("github"),
Repository: pulumi.String("terraform-template-module"),
IncludeAllBranches: pulumi.Bool(true),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.inputs.RepositoryTemplateArgs;
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 Repository("example", RepositoryArgs.builder()
.name("example")
.description("My awesome codebase")
.visibility("public")
.template(RepositoryTemplateArgs.builder()
.owner("github")
.repository("terraform-template-module")
.includeAllBranches(true)
.build())
.build());
}
}
resources:
example:
type: github:Repository
properties:
name: example
description: My awesome codebase
visibility: public
template:
owner: github
repository: terraform-template-module
includeAllBranches: true
With GitHub Pages Enabled
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = new github.Repository("example", {
name: "example",
description: "My awesome web page",
"private": false,
pages: {
source: {
branch: "master",
path: "/docs",
},
},
});
import pulumi
import pulumi_github as github
example = github.Repository("example",
name="example",
description="My awesome web page",
private=False,
pages={
"source": {
"branch": "master",
"path": "/docs",
},
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = new Github.Repository("example", new()
{
Name = "example",
Description = "My awesome web page",
Private = false,
Pages = new Github.Inputs.RepositoryPagesArgs
{
Source = new Github.Inputs.RepositoryPagesSourceArgs
{
Branch = "master",
Path = "/docs",
},
},
});
});
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.NewRepository(ctx, "example", &github.RepositoryArgs{
Name: pulumi.String("example"),
Description: pulumi.String("My awesome web page"),
Private: pulumi.Bool(false),
Pages: &github.RepositoryPagesArgs{
Source: &github.RepositoryPagesSourceArgs{
Branch: pulumi.String("master"),
Path: pulumi.String("/docs"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.inputs.RepositoryPagesArgs;
import com.pulumi.github.inputs.RepositoryPagesSourceArgs;
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 Repository("example", RepositoryArgs.builder()
.name("example")
.description("My awesome web page")
.private_(false)
.pages(RepositoryPagesArgs.builder()
.source(RepositoryPagesSourceArgs.builder()
.branch("master")
.path("/docs")
.build())
.build())
.build());
}
}
resources:
example:
type: github:Repository
properties:
name: example
description: My awesome web page
private: false
pages:
source:
branch: master
path: /docs
Import
Repositories can be imported using the name
, e.g.
$ pulumi import github:index/repository:Repository terraform terraform
Constructors
Properties
Set to true
to allow auto-merging pull requests on the repository.
Set to false
to disable merge commits on the repository.
Set to false
to disable rebase merges on the repository.
Set to false
to disable squash merges on the repository.
Set to true
to always suggest updating pull request branches.
Set to true
to archive the repository instead of deleting on destroy.
(Deprecated: Use github.BranchDefault
resource instead) The name of the default branch of the repository. NOTE: This can only be set after a repository has already been created, and after a correct reference has been created for the target branch inside the repository. This means a user will have to omit this parameter from the initial repository creation and create the target branch inside of the repository prior to setting this attribute.
Automatically delete head branch after a pull request is merged. Defaults to false
.
A description of the repository.
Use the name of the template without the extension. For example, "Haskell".
Set to true
to enable GitHub Discussions on the repository. Defaults to false
.
Set to true
to enable the (deprecated) downloads features on the repository.
Set to true
to enable the GitHub Projects features on the repository. Per the GitHub documentation when in an organization that has disabled repository projects it will default to false
and will otherwise default to true
. If you specify true
when it has been disabled it will return an error.
URL of a page describing the project.
Set to true
to not call the vulnerability alerts endpoint so the resource can also be used without admin permissions during read.
Set to true
to tell GitHub that this is a template repository.
Use the name of the template without the extension. For example, "mit" or "mpl-2.0".
Can be PR_BODY
, PR_TITLE
, or BLANK
for a default merge commit message. Applicable only if allow_merge_commit
is true
.
Can be PR_TITLE
or MERGE_MESSAGE
for a default merge commit title. Applicable only if allow_merge_commit
is true
.
The repository's GitHub Pages configuration. See GitHub Pages Configuration below for details.
The repository's security and analysis configuration. See Security and Analysis Configuration below for details.
Can be PR_BODY
, COMMIT_MESSAGES
, or BLANK
for a default squash merge commit message. Applicable only if allow_squash_merge
is true
.
Can be PR_TITLE
or COMMIT_OR_PR_TITLE
for a default squash merge commit title. Applicable only if allow_squash_merge
is true
.
Use a template repository to create this resource. See Template Repositories below for details.
Can be public
or private
. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be internal
. The visibility
parameter overrides the private
parameter.
Set to true
to enable security alerts for vulnerable dependencies. Enabling requires alerts to be enabled on the owner level. (Note for importing: GitHub enables the alerts on public repos but disables them on private repos by default.) See GitHub Documentation for details. Note that vulnerability alerts have not been successfully tested on any GitHub Enterprise instance and may be unavailable in those settings.
Require contributors to sign off on web-based commits. See more here. Defaults to false
.