Repository File Args
/* This resource allows you to create and manage files within a GitHub repository.
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.RepositoryFile;
import com.pulumi.github.RepositoryFileArgs;
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 fooRepository = new Repository("fooRepository", RepositoryArgs.builder()
.autoInit(true)
.build());
var fooRepositoryFile = new RepositoryFile("fooRepositoryFile", RepositoryFileArgs.builder()
.repository(fooRepository.name())
.branch("main")
.file(".gitignore")
.content("**/*.tfstate")
.commitMessage("Managed by Terraform")
.commitAuthor("Terraform User")
.commitEmail("terraform@example.com")
.overwriteOnCreate(true)
.build());
}
}
Import
Repository files can be imported using a combination of the repo
and file
, e.g.
$ 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.
$ pulumi import github:index/repositoryFile:RepositoryFile gitignore example/.gitignore:dev
Constructors
Properties
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.
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.
Commit message when adding or updating the managed file.
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.
The repository to create the file in.