@pulumi/github
Version:
A Pulumi package for creating and managing github cloud resources.
599 lines (598 loc) • 27.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* 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: `allowMergeCommit`, `allowSquashMerge`, `allowRebaseMerge`, `mergeCommitTitle`, `mergeCommitMessage`, `squashMergeCommitTitle` and `squashMergeCommitMessage`.
*
* ## Example Usage
*
* ```typescript
* 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,
* },
* });
* ```
*
* ### With GitHub Pages Enabled
*
* ```typescript
* 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
*
* Repositories can be imported using the `name`, e.g.
*
* ```sh
* $ pulumi import github:index/repository:Repository terraform terraform
* ```
*/
export declare class Repository extends pulumi.CustomResource {
/**
* Get an existing Repository resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: RepositoryState, opts?: pulumi.CustomResourceOptions): Repository;
/**
* Returns true if the given object is an instance of Repository. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Repository;
/**
* Set to `true` to allow auto-merging pull requests on the repository.
*/
readonly allowAutoMerge: pulumi.Output<boolean | undefined>;
/**
* Set to `false` to disable merge commits on the repository.
*/
readonly allowMergeCommit: pulumi.Output<boolean | undefined>;
/**
* Set to `false` to disable rebase merges on the repository.
*/
readonly allowRebaseMerge: pulumi.Output<boolean | undefined>;
/**
* Set to `false` to disable squash merges on the repository.
*/
readonly allowSquashMerge: pulumi.Output<boolean | undefined>;
/**
* Set to `true` to always suggest updating pull request branches.
*/
readonly allowUpdateBranch: pulumi.Output<boolean | undefined>;
/**
* Set to `true` to archive the repository instead of deleting on destroy.
*/
readonly archiveOnDestroy: pulumi.Output<boolean | undefined>;
/**
* Specifies if the repository should be archived. Defaults to `false`. **NOTE** Currently, the API does not support unarchiving.
*/
readonly archived: pulumi.Output<boolean | undefined>;
/**
* Set to `true` to produce an initial commit in the repository.
*/
readonly autoInit: pulumi.Output<boolean | undefined>;
/**
* (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.
*
* @deprecated Use the github.BranchDefault resource instead
*/
readonly defaultBranch: pulumi.Output<string>;
/**
* Automatically delete head branch after a pull request is merged. Defaults to `false`.
*/
readonly deleteBranchOnMerge: pulumi.Output<boolean | undefined>;
/**
* A description of the repository.
*/
readonly description: pulumi.Output<string | undefined>;
readonly etag: pulumi.Output<string>;
/**
* A string of the form "orgname/reponame".
*/
readonly fullName: pulumi.Output<string>;
/**
* URL that can be provided to `git clone` to clone the repository anonymously via the git protocol.
*/
readonly gitCloneUrl: pulumi.Output<string>;
/**
* Use the [name of the template](https://github.com/github/gitignore) without the extension. For example, "Haskell".
*/
readonly gitignoreTemplate: pulumi.Output<string | undefined>;
/**
* Set to `true` to enable GitHub Discussions on the repository. Defaults to `false`.
*/
readonly hasDiscussions: pulumi.Output<boolean | undefined>;
/**
* Set to `true` to enable the (deprecated) downloads features on the repository.
*/
readonly hasDownloads: pulumi.Output<boolean | undefined>;
/**
* Set to `true` to enable the GitHub Issues features
* on the repository.
*/
readonly hasIssues: pulumi.Output<boolean | undefined>;
/**
* Set to `true` to enable the GitHub Projects features on the repository. Per the GitHub [documentation](https://developer.github.com/v3/repos/#create) 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.
*/
readonly hasProjects: pulumi.Output<boolean | undefined>;
/**
* Set to `true` to enable the GitHub Wiki features on
* the repository.
*/
readonly hasWiki: pulumi.Output<boolean | undefined>;
/**
* URL of a page describing the project.
*/
readonly homepageUrl: pulumi.Output<string | undefined>;
/**
* The absolute URL (including scheme) of the rendered GitHub Pages site e.g. `https://username.github.io`.
*/
readonly htmlUrl: pulumi.Output<string>;
/**
* URL that can be provided to `git clone` to clone the repository via HTTPS.
*/
readonly httpCloneUrl: pulumi.Output<string>;
/**
* Set to `true` to not call the vulnerability alerts endpoint so the resource can also be used without admin permissions during read.
*/
readonly ignoreVulnerabilityAlertsDuringRead: pulumi.Output<boolean | undefined>;
/**
* Set to `true` to tell GitHub that this is a template repository.
*/
readonly isTemplate: pulumi.Output<boolean | undefined>;
/**
* Use the [name of the template](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) without the extension. For example, "mit" or "mpl-2.0".
*/
readonly licenseTemplate: pulumi.Output<string | undefined>;
/**
* Can be `PR_BODY`, `PR_TITLE`, or `BLANK` for a default merge commit message. Applicable only if `allowMergeCommit` is `true`.
*/
readonly mergeCommitMessage: pulumi.Output<string | undefined>;
/**
* Can be `PR_TITLE` or `MERGE_MESSAGE` for a default merge commit title. Applicable only if `allowMergeCommit` is `true`.
*/
readonly mergeCommitTitle: pulumi.Output<string | undefined>;
/**
* The name of the repository.
*/
readonly name: pulumi.Output<string>;
/**
* GraphQL global node id for use with v4 API
*/
readonly nodeId: pulumi.Output<string>;
/**
* The repository's GitHub Pages configuration. See GitHub Pages Configuration below for details.
*/
readonly pages: pulumi.Output<outputs.RepositoryPages | undefined>;
/**
* The primary language used in the repository.
*/
readonly primaryLanguage: pulumi.Output<string>;
/**
* Set to `true` to create a private repository.
* Repositories are created as public (e.g. open source) by default.
*
* @deprecated use visibility instead
*/
readonly private: pulumi.Output<boolean>;
/**
* GitHub ID for the repository
*/
readonly repoId: pulumi.Output<number>;
/**
* The repository's [security and analysis](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository) configuration. See Security and Analysis Configuration below for details.
*/
readonly securityAndAnalysis: pulumi.Output<outputs.RepositorySecurityAndAnalysis>;
/**
* Can be `PR_BODY`, `COMMIT_MESSAGES`, or `BLANK` for a default squash merge commit message. Applicable only if `allowSquashMerge` is `true`.
*/
readonly squashMergeCommitMessage: pulumi.Output<string | undefined>;
/**
* Can be `PR_TITLE` or `COMMIT_OR_PR_TITLE` for a default squash merge commit title. Applicable only if `allowSquashMerge` is `true`.
*/
readonly squashMergeCommitTitle: pulumi.Output<string | undefined>;
/**
* URL that can be provided to `git clone` to clone the repository via SSH.
*/
readonly sshCloneUrl: pulumi.Output<string>;
/**
* URL that can be provided to `svn checkout` to check out the repository via GitHub's Subversion protocol emulation.
*/
readonly svnUrl: pulumi.Output<string>;
/**
* Use a template repository to create this resource. See Template Repositories below for details.
*/
readonly template: pulumi.Output<outputs.RepositoryTemplate | undefined>;
/**
* The list of topics of the repository.
*/
readonly topics: pulumi.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.
*/
readonly visibility: pulumi.Output<string>;
/**
* 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](https://help.github.com/en/github/managing-security-vulnerabilities/about-security-alerts-for-vulnerable-dependencies) for details. Note that vulnerability alerts have not been successfully tested on any GitHub Enterprise instance and may be unavailable in those settings.
*/
readonly vulnerabilityAlerts: pulumi.Output<boolean | undefined>;
/**
* Require contributors to sign off on web-based commits. See more [here](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-the-commit-signoff-policy-for-your-repository). Defaults to `false`.
*/
readonly webCommitSignoffRequired: pulumi.Output<boolean | undefined>;
/**
* Create a Repository resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: RepositoryArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Repository resources.
*/
export interface RepositoryState {
/**
* Set to `true` to allow auto-merging pull requests on the repository.
*/
allowAutoMerge?: pulumi.Input<boolean>;
/**
* Set to `false` to disable merge commits on the repository.
*/
allowMergeCommit?: pulumi.Input<boolean>;
/**
* Set to `false` to disable rebase merges on the repository.
*/
allowRebaseMerge?: pulumi.Input<boolean>;
/**
* Set to `false` to disable squash merges on the repository.
*/
allowSquashMerge?: pulumi.Input<boolean>;
/**
* Set to `true` to always suggest updating pull request branches.
*/
allowUpdateBranch?: pulumi.Input<boolean>;
/**
* Set to `true` to archive the repository instead of deleting on destroy.
*/
archiveOnDestroy?: pulumi.Input<boolean>;
/**
* Specifies if the repository should be archived. Defaults to `false`. **NOTE** Currently, the API does not support unarchiving.
*/
archived?: pulumi.Input<boolean>;
/**
* Set to `true` to produce an initial commit in the repository.
*/
autoInit?: pulumi.Input<boolean>;
/**
* (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.
*
* @deprecated Use the github.BranchDefault resource instead
*/
defaultBranch?: pulumi.Input<string>;
/**
* Automatically delete head branch after a pull request is merged. Defaults to `false`.
*/
deleteBranchOnMerge?: pulumi.Input<boolean>;
/**
* A description of the repository.
*/
description?: pulumi.Input<string>;
etag?: pulumi.Input<string>;
/**
* A string of the form "orgname/reponame".
*/
fullName?: pulumi.Input<string>;
/**
* URL that can be provided to `git clone` to clone the repository anonymously via the git protocol.
*/
gitCloneUrl?: pulumi.Input<string>;
/**
* Use the [name of the template](https://github.com/github/gitignore) without the extension. For example, "Haskell".
*/
gitignoreTemplate?: pulumi.Input<string>;
/**
* Set to `true` to enable GitHub Discussions on the repository. Defaults to `false`.
*/
hasDiscussions?: pulumi.Input<boolean>;
/**
* Set to `true` to enable the (deprecated) downloads features on the repository.
*/
hasDownloads?: pulumi.Input<boolean>;
/**
* Set to `true` to enable the GitHub Issues features
* on the repository.
*/
hasIssues?: pulumi.Input<boolean>;
/**
* Set to `true` to enable the GitHub Projects features on the repository. Per the GitHub [documentation](https://developer.github.com/v3/repos/#create) 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.
*/
hasProjects?: pulumi.Input<boolean>;
/**
* Set to `true` to enable the GitHub Wiki features on
* the repository.
*/
hasWiki?: pulumi.Input<boolean>;
/**
* URL of a page describing the project.
*/
homepageUrl?: pulumi.Input<string>;
/**
* The absolute URL (including scheme) of the rendered GitHub Pages site e.g. `https://username.github.io`.
*/
htmlUrl?: pulumi.Input<string>;
/**
* URL that can be provided to `git clone` to clone the repository via HTTPS.
*/
httpCloneUrl?: pulumi.Input<string>;
/**
* Set to `true` to not call the vulnerability alerts endpoint so the resource can also be used without admin permissions during read.
*/
ignoreVulnerabilityAlertsDuringRead?: pulumi.Input<boolean>;
/**
* Set to `true` to tell GitHub that this is a template repository.
*/
isTemplate?: pulumi.Input<boolean>;
/**
* Use the [name of the template](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) without the extension. For example, "mit" or "mpl-2.0".
*/
licenseTemplate?: pulumi.Input<string>;
/**
* Can be `PR_BODY`, `PR_TITLE`, or `BLANK` for a default merge commit message. Applicable only if `allowMergeCommit` is `true`.
*/
mergeCommitMessage?: pulumi.Input<string>;
/**
* Can be `PR_TITLE` or `MERGE_MESSAGE` for a default merge commit title. Applicable only if `allowMergeCommit` is `true`.
*/
mergeCommitTitle?: pulumi.Input<string>;
/**
* The name of the repository.
*/
name?: pulumi.Input<string>;
/**
* GraphQL global node id for use with v4 API
*/
nodeId?: pulumi.Input<string>;
/**
* The repository's GitHub Pages configuration. See GitHub Pages Configuration below for details.
*/
pages?: pulumi.Input<inputs.RepositoryPages>;
/**
* The primary language used in the repository.
*/
primaryLanguage?: pulumi.Input<string>;
/**
* Set to `true` to create a private repository.
* Repositories are created as public (e.g. open source) by default.
*
* @deprecated use visibility instead
*/
private?: pulumi.Input<boolean>;
/**
* GitHub ID for the repository
*/
repoId?: pulumi.Input<number>;
/**
* The repository's [security and analysis](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository) configuration. See Security and Analysis Configuration below for details.
*/
securityAndAnalysis?: pulumi.Input<inputs.RepositorySecurityAndAnalysis>;
/**
* Can be `PR_BODY`, `COMMIT_MESSAGES`, or `BLANK` for a default squash merge commit message. Applicable only if `allowSquashMerge` is `true`.
*/
squashMergeCommitMessage?: pulumi.Input<string>;
/**
* Can be `PR_TITLE` or `COMMIT_OR_PR_TITLE` for a default squash merge commit title. Applicable only if `allowSquashMerge` is `true`.
*/
squashMergeCommitTitle?: pulumi.Input<string>;
/**
* URL that can be provided to `git clone` to clone the repository via SSH.
*/
sshCloneUrl?: pulumi.Input<string>;
/**
* URL that can be provided to `svn checkout` to check out the repository via GitHub's Subversion protocol emulation.
*/
svnUrl?: pulumi.Input<string>;
/**
* Use a template repository to create this resource. See Template Repositories below for details.
*/
template?: pulumi.Input<inputs.RepositoryTemplate>;
/**
* The list of topics of the repository.
*/
topics?: pulumi.Input<pulumi.Input<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.
*/
visibility?: pulumi.Input<string>;
/**
* 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](https://help.github.com/en/github/managing-security-vulnerabilities/about-security-alerts-for-vulnerable-dependencies) for details. Note that vulnerability alerts have not been successfully tested on any GitHub Enterprise instance and may be unavailable in those settings.
*/
vulnerabilityAlerts?: pulumi.Input<boolean>;
/**
* Require contributors to sign off on web-based commits. See more [here](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-the-commit-signoff-policy-for-your-repository). Defaults to `false`.
*/
webCommitSignoffRequired?: pulumi.Input<boolean>;
}
/**
* The set of arguments for constructing a Repository resource.
*/
export interface RepositoryArgs {
/**
* Set to `true` to allow auto-merging pull requests on the repository.
*/
allowAutoMerge?: pulumi.Input<boolean>;
/**
* Set to `false` to disable merge commits on the repository.
*/
allowMergeCommit?: pulumi.Input<boolean>;
/**
* Set to `false` to disable rebase merges on the repository.
*/
allowRebaseMerge?: pulumi.Input<boolean>;
/**
* Set to `false` to disable squash merges on the repository.
*/
allowSquashMerge?: pulumi.Input<boolean>;
/**
* Set to `true` to always suggest updating pull request branches.
*/
allowUpdateBranch?: pulumi.Input<boolean>;
/**
* Set to `true` to archive the repository instead of deleting on destroy.
*/
archiveOnDestroy?: pulumi.Input<boolean>;
/**
* Specifies if the repository should be archived. Defaults to `false`. **NOTE** Currently, the API does not support unarchiving.
*/
archived?: pulumi.Input<boolean>;
/**
* Set to `true` to produce an initial commit in the repository.
*/
autoInit?: pulumi.Input<boolean>;
/**
* (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.
*
* @deprecated Use the github.BranchDefault resource instead
*/
defaultBranch?: pulumi.Input<string>;
/**
* Automatically delete head branch after a pull request is merged. Defaults to `false`.
*/
deleteBranchOnMerge?: pulumi.Input<boolean>;
/**
* A description of the repository.
*/
description?: pulumi.Input<string>;
/**
* Use the [name of the template](https://github.com/github/gitignore) without the extension. For example, "Haskell".
*/
gitignoreTemplate?: pulumi.Input<string>;
/**
* Set to `true` to enable GitHub Discussions on the repository. Defaults to `false`.
*/
hasDiscussions?: pulumi.Input<boolean>;
/**
* Set to `true` to enable the (deprecated) downloads features on the repository.
*/
hasDownloads?: pulumi.Input<boolean>;
/**
* Set to `true` to enable the GitHub Issues features
* on the repository.
*/
hasIssues?: pulumi.Input<boolean>;
/**
* Set to `true` to enable the GitHub Projects features on the repository. Per the GitHub [documentation](https://developer.github.com/v3/repos/#create) 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.
*/
hasProjects?: pulumi.Input<boolean>;
/**
* Set to `true` to enable the GitHub Wiki features on
* the repository.
*/
hasWiki?: pulumi.Input<boolean>;
/**
* URL of a page describing the project.
*/
homepageUrl?: pulumi.Input<string>;
/**
* Set to `true` to not call the vulnerability alerts endpoint so the resource can also be used without admin permissions during read.
*/
ignoreVulnerabilityAlertsDuringRead?: pulumi.Input<boolean>;
/**
* Set to `true` to tell GitHub that this is a template repository.
*/
isTemplate?: pulumi.Input<boolean>;
/**
* Use the [name of the template](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) without the extension. For example, "mit" or "mpl-2.0".
*/
licenseTemplate?: pulumi.Input<string>;
/**
* Can be `PR_BODY`, `PR_TITLE`, or `BLANK` for a default merge commit message. Applicable only if `allowMergeCommit` is `true`.
*/
mergeCommitMessage?: pulumi.Input<string>;
/**
* Can be `PR_TITLE` or `MERGE_MESSAGE` for a default merge commit title. Applicable only if `allowMergeCommit` is `true`.
*/
mergeCommitTitle?: pulumi.Input<string>;
/**
* The name of the repository.
*/
name?: pulumi.Input<string>;
/**
* The repository's GitHub Pages configuration. See GitHub Pages Configuration below for details.
*/
pages?: pulumi.Input<inputs.RepositoryPages>;
/**
* Set to `true` to create a private repository.
* Repositories are created as public (e.g. open source) by default.
*
* @deprecated use visibility instead
*/
private?: pulumi.Input<boolean>;
/**
* The repository's [security and analysis](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository) configuration. See Security and Analysis Configuration below for details.
*/
securityAndAnalysis?: pulumi.Input<inputs.RepositorySecurityAndAnalysis>;
/**
* Can be `PR_BODY`, `COMMIT_MESSAGES`, or `BLANK` for a default squash merge commit message. Applicable only if `allowSquashMerge` is `true`.
*/
squashMergeCommitMessage?: pulumi.Input<string>;
/**
* Can be `PR_TITLE` or `COMMIT_OR_PR_TITLE` for a default squash merge commit title. Applicable only if `allowSquashMerge` is `true`.
*/
squashMergeCommitTitle?: pulumi.Input<string>;
/**
* Use a template repository to create this resource. See Template Repositories below for details.
*/
template?: pulumi.Input<inputs.RepositoryTemplate>;
/**
* The list of topics of the repository.
*/
topics?: pulumi.Input<pulumi.Input<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.
*/
visibility?: pulumi.Input<string>;
/**
* 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](https://help.github.com/en/github/managing-security-vulnerabilities/about-security-alerts-for-vulnerable-dependencies) for details. Note that vulnerability alerts have not been successfully tested on any GitHub Enterprise instance and may be unavailable in those settings.
*/
vulnerabilityAlerts?: pulumi.Input<boolean>;
/**
* Require contributors to sign off on web-based commits. See more [here](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-the-commit-signoff-policy-for-your-repository). Defaults to `false`.
*/
webCommitSignoffRequired?: pulumi.Input<boolean>;
}