@pulumi/github
Version:
A Pulumi package for creating and managing github cloud resources.
258 lines (257 loc) • 10.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* This resource allows you to create and manage files within a
* GitHub repository.
*
* ## Example Usage
*
* ### Existing Branch
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as github from "@pulumi/github";
*
* const foo = new github.Repository("foo", {
* name: "tf-acc-test-%s",
* autoInit: true,
* });
* const fooRepositoryFile = new github.RepositoryFile("foo", {
* repository: foo.name,
* branch: "main",
* file: ".gitignore",
* content: "**/*.tfstate",
* commitMessage: "Managed by Pulumi",
* commitAuthor: "Terraform User",
* commitEmail: "terraform@example.com",
* overwriteOnCreate: true,
* });
* ```
*
* ### Auto Created Branch
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as github from "@pulumi/github";
*
* const foo = new github.Repository("foo", {
* name: "tf-acc-test-%s",
* autoInit: true,
* });
* const fooRepositoryFile = new github.RepositoryFile("foo", {
* repository: foo.name,
* branch: "does/not/exist",
* file: ".gitignore",
* content: "**/*.tfstate",
* commitMessage: "Managed by Pulumi",
* commitAuthor: "Terraform User",
* commitEmail: "terraform@example.com",
* overwriteOnCreate: true,
* autocreateBranch: true,
* });
* ```
*
* ## Import
*
* Repository files can be imported using a combination of the `repo` and `file`, e.g.
*
* ```sh
* $ pulumi import github:index/repositoryFile:RepositoryFile gitignore example/.gitignore
* ```
* To import a file from a branch other than the default branch, append `:` and the branch name, e.g.
*
* ```sh
* $ pulumi import github:index/repositoryFile:RepositoryFile gitignore example/.gitignore:dev
* ```
*/
export declare class RepositoryFile extends pulumi.CustomResource {
/**
* Get an existing RepositoryFile 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?: RepositoryFileState, opts?: pulumi.CustomResourceOptions): RepositoryFile;
/**
* Returns true if the given object is an instance of RepositoryFile. 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 RepositoryFile;
/**
* Automatically create the branch if it could not be found. Defaults to false. Subsequent reads if the branch is deleted will occur from 'autocreate_branch_source_branch'.
*/
readonly autocreateBranch: pulumi.Output<boolean | undefined>;
/**
* The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
*/
readonly autocreateBranchSourceBranch: pulumi.Output<string | undefined>;
/**
* The commit hash to start from, if 'autocreate_branch' is set. Defaults to the tip of 'autocreate_branch_source_branch'. If provided, 'autocreate_branch_source_branch' is ignored.
*/
readonly autocreateBranchSourceSha: pulumi.Output<string>;
/**
* Git branch (defaults to the repository's default branch).
* The branch must already exist, it will only be created automatically if 'autocreate_branch' is set true.
*/
readonly branch: pulumi.Output<string | undefined>;
/**
* Committer author name to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This maybe useful when a branch protection rule requires signed commits.
*/
readonly commitAuthor: pulumi.Output<string | undefined>;
/**
* Committer email address to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This may be useful when a branch protection rule requires signed commits.
*/
readonly commitEmail: pulumi.Output<string | undefined>;
/**
* The commit message when creating, updating or deleting the managed file.
*/
readonly commitMessage: pulumi.Output<string>;
/**
* The SHA of the commit that modified the file.
*/
readonly commitSha: pulumi.Output<string>;
/**
* The file content.
*/
readonly content: pulumi.Output<string>;
/**
* The path of the file to manage.
*/
readonly file: pulumi.Output<string>;
/**
* Enable overwriting existing files. If set to `true` it will overwrite an existing file with the same name. If set to `false` it will fail if there is an existing file with the same name.
*/
readonly overwriteOnCreate: pulumi.Output<boolean | undefined>;
/**
* The name of the commit/branch/tag.
*/
readonly ref: pulumi.Output<string>;
/**
* The repository to create the file in.
*/
readonly repository: pulumi.Output<string>;
/**
* The SHA blob of the file.
*/
readonly sha: pulumi.Output<string>;
/**
* Create a RepositoryFile 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: RepositoryFileArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering RepositoryFile resources.
*/
export interface RepositoryFileState {
/**
* Automatically create the branch if it could not be found. Defaults to false. Subsequent reads if the branch is deleted will occur from 'autocreate_branch_source_branch'.
*/
autocreateBranch?: pulumi.Input<boolean>;
/**
* The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
*/
autocreateBranchSourceBranch?: pulumi.Input<string>;
/**
* The commit hash to start from, if 'autocreate_branch' is set. Defaults to the tip of 'autocreate_branch_source_branch'. If provided, 'autocreate_branch_source_branch' is ignored.
*/
autocreateBranchSourceSha?: pulumi.Input<string>;
/**
* Git branch (defaults to the repository's default branch).
* The branch must already exist, it will only be created automatically if 'autocreate_branch' is set true.
*/
branch?: pulumi.Input<string>;
/**
* Committer author name to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This maybe useful when a branch protection rule requires signed commits.
*/
commitAuthor?: pulumi.Input<string>;
/**
* Committer email address to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This may be useful when a branch protection rule requires signed commits.
*/
commitEmail?: pulumi.Input<string>;
/**
* The commit message when creating, updating or deleting the managed file.
*/
commitMessage?: pulumi.Input<string>;
/**
* The SHA of the commit that modified the file.
*/
commitSha?: pulumi.Input<string>;
/**
* The file content.
*/
content?: pulumi.Input<string>;
/**
* The path of the file to manage.
*/
file?: pulumi.Input<string>;
/**
* Enable overwriting existing files. If set to `true` it will overwrite an existing file with the same name. If set to `false` it will fail if there is an existing file with the same name.
*/
overwriteOnCreate?: pulumi.Input<boolean>;
/**
* The name of the commit/branch/tag.
*/
ref?: pulumi.Input<string>;
/**
* The repository to create the file in.
*/
repository?: pulumi.Input<string>;
/**
* The SHA blob of the file.
*/
sha?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a RepositoryFile resource.
*/
export interface RepositoryFileArgs {
/**
* Automatically create the branch if it could not be found. Defaults to false. Subsequent reads if the branch is deleted will occur from 'autocreate_branch_source_branch'.
*/
autocreateBranch?: pulumi.Input<boolean>;
/**
* The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
*/
autocreateBranchSourceBranch?: pulumi.Input<string>;
/**
* The commit hash to start from, if 'autocreate_branch' is set. Defaults to the tip of 'autocreate_branch_source_branch'. If provided, 'autocreate_branch_source_branch' is ignored.
*/
autocreateBranchSourceSha?: pulumi.Input<string>;
/**
* Git branch (defaults to the repository's default branch).
* The branch must already exist, it will only be created automatically if 'autocreate_branch' is set true.
*/
branch?: pulumi.Input<string>;
/**
* Committer author name to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This maybe useful when a branch protection rule requires signed commits.
*/
commitAuthor?: pulumi.Input<string>;
/**
* Committer email address to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This may be useful when a branch protection rule requires signed commits.
*/
commitEmail?: pulumi.Input<string>;
/**
* The commit message when creating, updating or deleting the managed file.
*/
commitMessage?: pulumi.Input<string>;
/**
* The file content.
*/
content: pulumi.Input<string>;
/**
* The path of the file to manage.
*/
file: pulumi.Input<string>;
/**
* Enable overwriting existing files. If set to `true` it will overwrite an existing file with the same name. If set to `false` it will fail if there is an existing file with the same name.
*/
overwriteOnCreate?: pulumi.Input<boolean>;
/**
* The repository to create the file in.
*/
repository: pulumi.Input<string>;
}