1. Packages
  2. Github Provider
  3. API Docs
  4. RepositoryFile
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

github.RepositoryFile

Explore with Pulumi AI

github logo
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

    This resource allows you to create and manage files within a GitHub repository.

    Example Usage

    Existing Branch

    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 Terraform",
        commitAuthor: "Terraform User",
        commitEmail: "terraform@example.com",
        overwriteOnCreate: true,
    });
    
    import pulumi
    import pulumi_github as github
    
    foo = github.Repository("foo",
        name="tf-acc-test-%s",
        auto_init=True)
    foo_repository_file = github.RepositoryFile("foo",
        repository=foo.name,
        branch="main",
        file=".gitignore",
        content="**/*.tfstate",
        commit_message="Managed by Terraform",
        commit_author="Terraform User",
        commit_email="terraform@example.com",
        overwrite_on_create=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := github.NewRepository(ctx, "foo", &github.RepositoryArgs{
    			Name:     pulumi.String("tf-acc-test-%s"),
    			AutoInit: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewRepositoryFile(ctx, "foo", &github.RepositoryFileArgs{
    			Repository:        foo.Name,
    			Branch:            pulumi.String("main"),
    			File:              pulumi.String(".gitignore"),
    			Content:           pulumi.String("**/*.tfstate"),
    			CommitMessage:     pulumi.String("Managed by Terraform"),
    			CommitAuthor:      pulumi.String("Terraform User"),
    			CommitEmail:       pulumi.String("terraform@example.com"),
    			OverwriteOnCreate: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = new Github.Repository("foo", new()
        {
            Name = "tf-acc-test-%s",
            AutoInit = true,
        });
    
        var fooRepositoryFile = new Github.RepositoryFile("foo", new()
        {
            Repository = foo.Name,
            Branch = "main",
            File = ".gitignore",
            Content = "**/*.tfstate",
            CommitMessage = "Managed by Terraform",
            CommitAuthor = "Terraform User",
            CommitEmail = "terraform@example.com",
            OverwriteOnCreate = true,
        });
    
    });
    
    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 foo = new Repository("foo", RepositoryArgs.builder()
                .name("tf-acc-test-%s")
                .autoInit(true)
                .build());
    
            var fooRepositoryFile = new RepositoryFile("fooRepositoryFile", RepositoryFileArgs.builder()
                .repository(foo.name())
                .branch("main")
                .file(".gitignore")
                .content("**/*.tfstate")
                .commitMessage("Managed by Terraform")
                .commitAuthor("Terraform User")
                .commitEmail("terraform@example.com")
                .overwriteOnCreate(true)
                .build());
    
        }
    }
    
    resources:
      foo:
        type: github:Repository
        properties:
          name: tf-acc-test-%s
          autoInit: true
      fooRepositoryFile:
        type: github:RepositoryFile
        name: foo
        properties:
          repository: ${foo.name}
          branch: main
          file: .gitignore
          content: '**/*.tfstate'
          commitMessage: Managed by Terraform
          commitAuthor: Terraform User
          commitEmail: terraform@example.com
          overwriteOnCreate: true
    

    Auto Created Branch

    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 Terraform",
        commitAuthor: "Terraform User",
        commitEmail: "terraform@example.com",
        overwriteOnCreate: true,
        autocreateBranch: true,
    });
    
    import pulumi
    import pulumi_github as github
    
    foo = github.Repository("foo",
        name="tf-acc-test-%s",
        auto_init=True)
    foo_repository_file = github.RepositoryFile("foo",
        repository=foo.name,
        branch="does/not/exist",
        file=".gitignore",
        content="**/*.tfstate",
        commit_message="Managed by Terraform",
        commit_author="Terraform User",
        commit_email="terraform@example.com",
        overwrite_on_create=True,
        autocreate_branch=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := github.NewRepository(ctx, "foo", &github.RepositoryArgs{
    			Name:     pulumi.String("tf-acc-test-%s"),
    			AutoInit: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewRepositoryFile(ctx, "foo", &github.RepositoryFileArgs{
    			Repository:        foo.Name,
    			Branch:            pulumi.String("does/not/exist"),
    			File:              pulumi.String(".gitignore"),
    			Content:           pulumi.String("**/*.tfstate"),
    			CommitMessage:     pulumi.String("Managed by Terraform"),
    			CommitAuthor:      pulumi.String("Terraform User"),
    			CommitEmail:       pulumi.String("terraform@example.com"),
    			OverwriteOnCreate: pulumi.Bool(true),
    			AutocreateBranch:  pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = new Github.Repository("foo", new()
        {
            Name = "tf-acc-test-%s",
            AutoInit = true,
        });
    
        var fooRepositoryFile = new Github.RepositoryFile("foo", new()
        {
            Repository = foo.Name,
            Branch = "does/not/exist",
            File = ".gitignore",
            Content = "**/*.tfstate",
            CommitMessage = "Managed by Terraform",
            CommitAuthor = "Terraform User",
            CommitEmail = "terraform@example.com",
            OverwriteOnCreate = true,
            AutocreateBranch = true,
        });
    
    });
    
    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 foo = new Repository("foo", RepositoryArgs.builder()
                .name("tf-acc-test-%s")
                .autoInit(true)
                .build());
    
            var fooRepositoryFile = new RepositoryFile("fooRepositoryFile", RepositoryFileArgs.builder()
                .repository(foo.name())
                .branch("does/not/exist")
                .file(".gitignore")
                .content("**/*.tfstate")
                .commitMessage("Managed by Terraform")
                .commitAuthor("Terraform User")
                .commitEmail("terraform@example.com")
                .overwriteOnCreate(true)
                .autocreateBranch(true)
                .build());
    
        }
    }
    
    resources:
      foo:
        type: github:Repository
        properties:
          name: tf-acc-test-%s
          autoInit: true
      fooRepositoryFile:
        type: github:RepositoryFile
        name: foo
        properties:
          repository: ${foo.name}
          branch: does/not/exist
          file: .gitignore
          content: '**/*.tfstate'
          commitMessage: Managed by Terraform
          commitAuthor: Terraform User
          commitEmail: terraform@example.com
          overwriteOnCreate: true
          autocreateBranch: true
    

    Create RepositoryFile Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RepositoryFile(name: string, args: RepositoryFileArgs, opts?: CustomResourceOptions);
    @overload
    def RepositoryFile(resource_name: str,
                       args: RepositoryFileArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def RepositoryFile(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       content: Optional[str] = None,
                       file: Optional[str] = None,
                       repository: Optional[str] = None,
                       autocreate_branch: Optional[bool] = None,
                       autocreate_branch_source_branch: Optional[str] = None,
                       autocreate_branch_source_sha: Optional[str] = None,
                       branch: Optional[str] = None,
                       commit_author: Optional[str] = None,
                       commit_email: Optional[str] = None,
                       commit_message: Optional[str] = None,
                       overwrite_on_create: Optional[bool] = None)
    func NewRepositoryFile(ctx *Context, name string, args RepositoryFileArgs, opts ...ResourceOption) (*RepositoryFile, error)
    public RepositoryFile(string name, RepositoryFileArgs args, CustomResourceOptions? opts = null)
    public RepositoryFile(String name, RepositoryFileArgs args)
    public RepositoryFile(String name, RepositoryFileArgs args, CustomResourceOptions options)
    
    type: github:RepositoryFile
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RepositoryFileArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RepositoryFileArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RepositoryFileArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RepositoryFileArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RepositoryFileArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var repositoryFileResource = new Github.RepositoryFile("repositoryFileResource", new()
    {
        Content = "string",
        File = "string",
        Repository = "string",
        AutocreateBranch = false,
        AutocreateBranchSourceBranch = "string",
        AutocreateBranchSourceSha = "string",
        Branch = "string",
        CommitAuthor = "string",
        CommitEmail = "string",
        CommitMessage = "string",
        OverwriteOnCreate = false,
    });
    
    example, err := github.NewRepositoryFile(ctx, "repositoryFileResource", &github.RepositoryFileArgs{
    	Content:                      pulumi.String("string"),
    	File:                         pulumi.String("string"),
    	Repository:                   pulumi.String("string"),
    	AutocreateBranch:             pulumi.Bool(false),
    	AutocreateBranchSourceBranch: pulumi.String("string"),
    	AutocreateBranchSourceSha:    pulumi.String("string"),
    	Branch:                       pulumi.String("string"),
    	CommitAuthor:                 pulumi.String("string"),
    	CommitEmail:                  pulumi.String("string"),
    	CommitMessage:                pulumi.String("string"),
    	OverwriteOnCreate:            pulumi.Bool(false),
    })
    
    var repositoryFileResource = new RepositoryFile("repositoryFileResource", RepositoryFileArgs.builder()
        .content("string")
        .file("string")
        .repository("string")
        .autocreateBranch(false)
        .autocreateBranchSourceBranch("string")
        .autocreateBranchSourceSha("string")
        .branch("string")
        .commitAuthor("string")
        .commitEmail("string")
        .commitMessage("string")
        .overwriteOnCreate(false)
        .build());
    
    repository_file_resource = github.RepositoryFile("repositoryFileResource",
        content="string",
        file="string",
        repository="string",
        autocreate_branch=False,
        autocreate_branch_source_branch="string",
        autocreate_branch_source_sha="string",
        branch="string",
        commit_author="string",
        commit_email="string",
        commit_message="string",
        overwrite_on_create=False)
    
    const repositoryFileResource = new github.RepositoryFile("repositoryFileResource", {
        content: "string",
        file: "string",
        repository: "string",
        autocreateBranch: false,
        autocreateBranchSourceBranch: "string",
        autocreateBranchSourceSha: "string",
        branch: "string",
        commitAuthor: "string",
        commitEmail: "string",
        commitMessage: "string",
        overwriteOnCreate: false,
    });
    
    type: github:RepositoryFile
    properties:
        autocreateBranch: false
        autocreateBranchSourceBranch: string
        autocreateBranchSourceSha: string
        branch: string
        commitAuthor: string
        commitEmail: string
        commitMessage: string
        content: string
        file: string
        overwriteOnCreate: false
        repository: string
    

    RepositoryFile Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The RepositoryFile resource accepts the following input properties:

    Content string
    The file content.
    File string
    The path of the file to manage.
    Repository string
    The repository to create the file in.
    AutocreateBranch bool
    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'.
    AutocreateBranchSourceBranch string
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    AutocreateBranchSourceSha 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.
    Branch 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.
    CommitAuthor 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.
    CommitEmail 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.
    CommitMessage string
    The commit message when creating, updating or deleting the managed file.
    OverwriteOnCreate bool
    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.
    Content string
    The file content.
    File string
    The path of the file to manage.
    Repository string
    The repository to create the file in.
    AutocreateBranch bool
    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'.
    AutocreateBranchSourceBranch string
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    AutocreateBranchSourceSha 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.
    Branch 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.
    CommitAuthor 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.
    CommitEmail 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.
    CommitMessage string
    The commit message when creating, updating or deleting the managed file.
    OverwriteOnCreate bool
    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.
    content String
    The file content.
    file String
    The path of the file to manage.
    repository String
    The repository to create the file in.
    autocreateBranch Boolean
    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'.
    autocreateBranchSourceBranch String
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    autocreateBranchSourceSha 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.
    branch 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.
    commitAuthor 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.
    commitEmail 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.
    commitMessage String
    The commit message when creating, updating or deleting the managed file.
    overwriteOnCreate Boolean
    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.
    content string
    The file content.
    file string
    The path of the file to manage.
    repository string
    The repository to create the file in.
    autocreateBranch boolean
    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'.
    autocreateBranchSourceBranch string
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    autocreateBranchSourceSha 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.
    branch 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.
    commitAuthor 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.
    commitEmail 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.
    commitMessage string
    The commit message when creating, updating or deleting the managed file.
    overwriteOnCreate boolean
    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.
    content str
    The file content.
    file str
    The path of the file to manage.
    repository str
    The repository to create the file in.
    autocreate_branch bool
    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'.
    autocreate_branch_source_branch str
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    autocreate_branch_source_sha str
    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.
    branch str
    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.
    commit_author str
    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.
    commit_email str
    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 str
    The commit message when creating, updating or deleting the managed file.
    overwrite_on_create bool
    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.
    content String
    The file content.
    file String
    The path of the file to manage.
    repository String
    The repository to create the file in.
    autocreateBranch Boolean
    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'.
    autocreateBranchSourceBranch String
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    autocreateBranchSourceSha 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.
    branch 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.
    commitAuthor 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.
    commitEmail 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.
    commitMessage String
    The commit message when creating, updating or deleting the managed file.
    overwriteOnCreate Boolean
    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.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RepositoryFile resource produces the following output properties:

    CommitSha string
    The SHA of the commit that modified the file.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ref string
    The name of the commit/branch/tag.
    Sha string
    The SHA blob of the file.
    CommitSha string
    The SHA of the commit that modified the file.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ref string
    The name of the commit/branch/tag.
    Sha string
    The SHA blob of the file.
    commitSha String
    The SHA of the commit that modified the file.
    id String
    The provider-assigned unique ID for this managed resource.
    ref String
    The name of the commit/branch/tag.
    sha String
    The SHA blob of the file.
    commitSha string
    The SHA of the commit that modified the file.
    id string
    The provider-assigned unique ID for this managed resource.
    ref string
    The name of the commit/branch/tag.
    sha string
    The SHA blob of the file.
    commit_sha str
    The SHA of the commit that modified the file.
    id str
    The provider-assigned unique ID for this managed resource.
    ref str
    The name of the commit/branch/tag.
    sha str
    The SHA blob of the file.
    commitSha String
    The SHA of the commit that modified the file.
    id String
    The provider-assigned unique ID for this managed resource.
    ref String
    The name of the commit/branch/tag.
    sha String
    The SHA blob of the file.

    Look up Existing RepositoryFile Resource

    Get an existing RepositoryFile resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RepositoryFileState, opts?: CustomResourceOptions): RepositoryFile
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            autocreate_branch: Optional[bool] = None,
            autocreate_branch_source_branch: Optional[str] = None,
            autocreate_branch_source_sha: Optional[str] = None,
            branch: Optional[str] = None,
            commit_author: Optional[str] = None,
            commit_email: Optional[str] = None,
            commit_message: Optional[str] = None,
            commit_sha: Optional[str] = None,
            content: Optional[str] = None,
            file: Optional[str] = None,
            overwrite_on_create: Optional[bool] = None,
            ref: Optional[str] = None,
            repository: Optional[str] = None,
            sha: Optional[str] = None) -> RepositoryFile
    func GetRepositoryFile(ctx *Context, name string, id IDInput, state *RepositoryFileState, opts ...ResourceOption) (*RepositoryFile, error)
    public static RepositoryFile Get(string name, Input<string> id, RepositoryFileState? state, CustomResourceOptions? opts = null)
    public static RepositoryFile get(String name, Output<String> id, RepositoryFileState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AutocreateBranch bool
    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'.
    AutocreateBranchSourceBranch string
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    AutocreateBranchSourceSha 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.
    Branch 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.
    CommitAuthor 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.
    CommitEmail 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.
    CommitMessage string
    The commit message when creating, updating or deleting the managed file.
    CommitSha string
    The SHA of the commit that modified the file.
    Content string
    The file content.
    File string
    The path of the file to manage.
    OverwriteOnCreate bool
    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.
    Ref string
    The name of the commit/branch/tag.
    Repository string
    The repository to create the file in.
    Sha string
    The SHA blob of the file.
    AutocreateBranch bool
    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'.
    AutocreateBranchSourceBranch string
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    AutocreateBranchSourceSha 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.
    Branch 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.
    CommitAuthor 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.
    CommitEmail 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.
    CommitMessage string
    The commit message when creating, updating or deleting the managed file.
    CommitSha string
    The SHA of the commit that modified the file.
    Content string
    The file content.
    File string
    The path of the file to manage.
    OverwriteOnCreate bool
    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.
    Ref string
    The name of the commit/branch/tag.
    Repository string
    The repository to create the file in.
    Sha string
    The SHA blob of the file.
    autocreateBranch Boolean
    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'.
    autocreateBranchSourceBranch String
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    autocreateBranchSourceSha 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.
    branch 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.
    commitAuthor 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.
    commitEmail 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.
    commitMessage String
    The commit message when creating, updating or deleting the managed file.
    commitSha String
    The SHA of the commit that modified the file.
    content String
    The file content.
    file String
    The path of the file to manage.
    overwriteOnCreate Boolean
    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.
    ref String
    The name of the commit/branch/tag.
    repository String
    The repository to create the file in.
    sha String
    The SHA blob of the file.
    autocreateBranch boolean
    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'.
    autocreateBranchSourceBranch string
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    autocreateBranchSourceSha 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.
    branch 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.
    commitAuthor 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.
    commitEmail 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.
    commitMessage string
    The commit message when creating, updating or deleting the managed file.
    commitSha string
    The SHA of the commit that modified the file.
    content string
    The file content.
    file string
    The path of the file to manage.
    overwriteOnCreate boolean
    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.
    ref string
    The name of the commit/branch/tag.
    repository string
    The repository to create the file in.
    sha string
    The SHA blob of the file.
    autocreate_branch bool
    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'.
    autocreate_branch_source_branch str
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    autocreate_branch_source_sha str
    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.
    branch str
    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.
    commit_author str
    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.
    commit_email str
    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 str
    The commit message when creating, updating or deleting the managed file.
    commit_sha str
    The SHA of the commit that modified the file.
    content str
    The file content.
    file str
    The path of the file to manage.
    overwrite_on_create bool
    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.
    ref str
    The name of the commit/branch/tag.
    repository str
    The repository to create the file in.
    sha str
    The SHA blob of the file.
    autocreateBranch Boolean
    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'.
    autocreateBranchSourceBranch String
    The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
    autocreateBranchSourceSha 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.
    branch 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.
    commitAuthor 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.
    commitEmail 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.
    commitMessage String
    The commit message when creating, updating or deleting the managed file.
    commitSha String
    The SHA of the commit that modified the file.
    content String
    The file content.
    file String
    The path of the file to manage.
    overwriteOnCreate Boolean
    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.
    ref String
    The name of the commit/branch/tag.
    repository String
    The repository to create the file in.
    sha String
    The SHA blob of the file.

    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
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi