Repository

class Repository : KotlinCustomResource

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 or else the allow_merge_commit, allow_rebase_merge, and allow_squash_merge attributes will be ignored, causing confusing diffs.

Example Usage

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()
.description("My awesome codebase")
.template(RepositoryTemplateArgs.builder()
.includeAllBranches(true)
.owner("github")
.repository("terraform-template-module")
.build())
.visibility("public")
.build());
}
}

With GitHub Pages Enabled

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()
.description("My awesome web page")
.pages(RepositoryPagesArgs.builder()
.source(RepositoryPagesSourceArgs.builder()
.branch("master")
.path("/docs")
.build())
.build())
.private_(false)
.build());
}
}

Import

Repositories can be imported using the name, e.g.

$ pulumi import github:index/repository:Repository terraform terraform

Properties

Link copied to clipboard
val allowAutoMerge: Output<Boolean>?

Set to true to allow auto-merging pull requests on the repository.

Link copied to clipboard

Set to false to disable merge commits on the repository.

Link copied to clipboard

Set to false to disable rebase merges on the repository.

Link copied to clipboard

Set to false to disable squash merges on the repository.

Link copied to clipboard

Set to true to always suggest updating pull request branches.

Link copied to clipboard
val archived: Output<Boolean>?

Specifies if the repository should be archived. Defaults to false. NOTE Currently, the API does not support unarchiving.

Link copied to clipboard

Set to true to archive the repository instead of deleting on destroy.

Link copied to clipboard
val autoInit: Output<Boolean>?

Set to true to produce an initial commit in the repository.

Link copied to clipboard
val defaultBranch: Output<String>

(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.

Link copied to clipboard

Automatically delete head branch after a pull request is merged. Defaults to false.

Link copied to clipboard
val description: Output<String>?

A description of the repository.

Link copied to clipboard
val etag: Output<String>
Link copied to clipboard
val fullName: Output<String>

A string of the form "orgname/reponame".

Link copied to clipboard
val gitCloneUrl: Output<String>

URL that can be provided to git clone to clone the repository anonymously via the git protocol.

Link copied to clipboard

Use the name of the template without the extension. For example, "Haskell".

Link copied to clipboard
val hasDiscussions: Output<Boolean>?

Set to true to enable GitHub Discussions on the repository. Defaults to false.

Link copied to clipboard
val hasDownloads: Output<Boolean>?

Set to true to enable the (deprecated) downloads features on the repository.

Link copied to clipboard
val hasIssues: Output<Boolean>?

Set to true to enable the GitHub Issues features on the repository.

Link copied to clipboard
val hasProjects: Output<Boolean>?

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.

Link copied to clipboard
val hasWiki: Output<Boolean>?

Set to true to enable the GitHub Wiki features on the repository.

Link copied to clipboard
val homepageUrl: Output<String>?

URL of a page describing the project.

Link copied to clipboard
val htmlUrl: Output<String>

The absolute URL (including scheme) of the rendered GitHub Pages site e.g. https://username.github.io.

Link copied to clipboard
val httpCloneUrl: Output<String>

URL that can be provided to git clone to clone the repository via HTTPS.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Set to true to not call the vulnerability alerts endpoint so the resource can also be used without admin permissions during read.

Link copied to clipboard
val isTemplate: Output<Boolean>?

Set to true to tell GitHub that this is a template repository.

Link copied to clipboard
val licenseTemplate: Output<String>?

Use the name of the template without the extension. For example, "mit" or "mpl-2.0".

Link copied to clipboard

Can be PR_BODY, PR_TITLE, or BLANK for a default merge commit message. Applicable only if allow_merge_commit is true.

Link copied to clipboard
val mergeCommitTitle: Output<String>?

Can be PR_TITLE or MERGE_MESSAGE for a default merge commit title. Applicable only if allow_merge_commit is true.

Link copied to clipboard
val name: Output<String>

The name of the repository.

Link copied to clipboard
val nodeId: Output<String>

GraphQL global node id for use with v4 API

Link copied to clipboard
val pages: Output<RepositoryPages>?

The repository's GitHub Pages configuration. See GitHub Pages Configuration below for details.

Link copied to clipboard
val primaryLanguage: Output<String>

The primary language used in the repository.

Link copied to clipboard
val private: Output<Boolean>

Set to true to create a private repository. Repositories are created as public (e.g. open source) by default.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val repoId: Output<Int>

GitHub ID for the repository

Link copied to clipboard

The repository's security and analysis configuration. See Security and Analysis Configuration below for details.

Link copied to clipboard

Can be PR_BODY, COMMIT_MESSAGES, or BLANK for a default squash merge commit message. Applicable only if allow_squash_merge is true.

Link copied to clipboard

Can be PR_TITLE or COMMIT_OR_PR_TITLE for a default squash merge commit title. Applicable only if allow_squash_merge is true.

Link copied to clipboard
val sshCloneUrl: Output<String>

URL that can be provided to git clone to clone the repository via SSH.

Link copied to clipboard
val svnUrl: Output<String>

URL that can be provided to svn checkout to check out the repository via GitHub's Subversion protocol emulation.

Link copied to clipboard

Use a template repository to create this resource. See Template Repositories below for details.

Link copied to clipboard
val topics: Output<List<String>>

The list of topics of the repository.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val visibility: Output<String>

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.

Link copied to clipboard

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.

Link copied to clipboard

Require contributors to sign off on web-based commits. See more here. Defaults to false.