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 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
Constructors
Functions
Properties
(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.
Use the name of the template without the extension. For example, "Haskell".
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.
Use the name of the template without the extension. For example, "mit" or "mpl-2.0".
The repository's security and analysis configuration. See Security and Analysis Configuration below for details.
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.