Repository
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 theallow_merge_commit
,allow_rebase_merge
, andallow_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
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.
URL that can be provided to git clone
to clone the repository anonymously via the git protocol.
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.
URL that can be provided to git clone
to clone the repository via HTTPS.
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 primary language used in the repository.
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
.
URL that can be provided to git clone
to clone the repository via SSH.
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
.