Viewing docs for GitHub v4.17.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
Viewing docs for GitHub v4.17.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
This data source allows you to read files within a GitHub repository.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var foo = Github.GetRepositoryFile.Invoke(new()
{
Repository = github_repository.Foo.Name,
Branch = "main",
File = ".gitignore",
});
});
package main
import (
"github.com/pulumi/pulumi-github/sdk/v4/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := github.LookupRepositoryFile(ctx, &GetRepositoryFileArgs{
Repository: github_repository.Foo.Name,
Branch: pulumi.StringRef("main"),
File: ".gitignore",
}, nil)
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.GithubFunctions;
import com.pulumi.github.inputs.GetRepositoryFileArgs;
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) {
final var foo = GithubFunctions.getRepositoryFile(GetRepositoryFileArgs.builder()
.repository(github_repository.foo().name())
.branch("main")
.file(".gitignore")
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const foo = github.getRepositoryFile({
repository: github_repository.foo.name,
branch: "main",
file: ".gitignore",
});
import pulumi
import pulumi_github as github
foo = github.get_repository_file(repository=github_repository["foo"]["name"],
branch="main",
file=".gitignore")
variables:
foo:
Fn::Invoke:
Function: github:getRepositoryFile
Arguments:
repository: ${github_repository.foo.name}
branch: main
file: .gitignore
Using getRepositoryFile
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRepositoryFile(args: GetRepositoryFileArgs, opts?: InvokeOptions): Promise<GetRepositoryFileResult>
function getRepositoryFileOutput(args: GetRepositoryFileOutputArgs, opts?: InvokeOptions): Output<GetRepositoryFileResult>def get_repository_file(branch: Optional[str] = None,
file: Optional[str] = None,
repository: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRepositoryFileResult
def get_repository_file_output(branch: Optional[pulumi.Input[str]] = None,
file: Optional[pulumi.Input[str]] = None,
repository: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRepositoryFileResult]func LookupRepositoryFile(ctx *Context, args *LookupRepositoryFileArgs, opts ...InvokeOption) (*LookupRepositoryFileResult, error)
func LookupRepositoryFileOutput(ctx *Context, args *LookupRepositoryFileOutputArgs, opts ...InvokeOption) LookupRepositoryFileResultOutput> Note: This function is named LookupRepositoryFile in the Go SDK.
public static class GetRepositoryFile
{
public static Task<GetRepositoryFileResult> InvokeAsync(GetRepositoryFileArgs args, InvokeOptions? opts = null)
public static Output<GetRepositoryFileResult> Invoke(GetRepositoryFileInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRepositoryFileResult> getRepositoryFile(GetRepositoryFileArgs args, InvokeOptions options)
public static Output<GetRepositoryFileResult> getRepositoryFile(GetRepositoryFileArgs args, InvokeOptions options)
fn::invoke:
function: github:index/getRepositoryFile:getRepositoryFile
arguments:
# arguments dictionaryThe following arguments are supported:
- File string
- The path of the file to manage.
- Repository string
- The repository to create the file in.
- Branch string
- Git branch (defaults to
main). The branch must already exist, it will not be created if it does not already exist.
- File string
- The path of the file to manage.
- Repository string
- The repository to create the file in.
- Branch string
- Git branch (defaults to
main). The branch must already exist, it will not be created if it does not already exist.
- file String
- The path of the file to manage.
- repository String
- The repository to create the file in.
- branch String
- Git branch (defaults to
main). The branch must already exist, it will not be created if it does not already exist.
- file string
- The path of the file to manage.
- repository string
- The repository to create the file in.
- branch string
- Git branch (defaults to
main). The branch must already exist, it will not be created if it does not already exist.
- file str
- The path of the file to manage.
- repository str
- The repository to create the file in.
- branch str
- Git branch (defaults to
main). The branch must already exist, it will not be created if it does not already exist.
- file String
- The path of the file to manage.
- repository String
- The repository to create the file in.
- branch String
- Git branch (defaults to
main). The branch must already exist, it will not be created if it does not already exist.
getRepositoryFile Result
The following output properties are available:
- string
- Committer author name.
- Commit
Email string - Committer email address.
- Commit
Message string - Commit message when file was last updated.
- Commit
Sha string - The SHA of the commit that modified the file.
- Content string
- The file content.
- File string
- Id string
- The provider-assigned unique ID for this managed resource.
- Repository string
- Sha string
- The SHA blob of the file.
- Branch string
- string
- Committer author name.
- Commit
Email string - Committer email address.
- Commit
Message string - Commit message when file was last updated.
- Commit
Sha string - The SHA of the commit that modified the file.
- Content string
- The file content.
- File string
- Id string
- The provider-assigned unique ID for this managed resource.
- Repository string
- Sha string
- The SHA blob of the file.
- Branch string
- String
- Committer author name.
- commit
Email String - Committer email address.
- commit
Message String - Commit message when file was last updated.
- commit
Sha String - The SHA of the commit that modified the file.
- content String
- The file content.
- file String
- id String
- The provider-assigned unique ID for this managed resource.
- repository String
- sha String
- The SHA blob of the file.
- branch String
- string
- Committer author name.
- commit
Email string - Committer email address.
- commit
Message string - Commit message when file was last updated.
- commit
Sha string - The SHA of the commit that modified the file.
- content string
- The file content.
- file string
- id string
- The provider-assigned unique ID for this managed resource.
- repository string
- sha string
- The SHA blob of the file.
- branch string
- str
- Committer author name.
- commit_
email str - Committer email address.
- commit_
message str - Commit message when file was last updated.
- commit_
sha str - The SHA of the commit that modified the file.
- content str
- The file content.
- file str
- id str
- The provider-assigned unique ID for this managed resource.
- repository str
- sha str
- The SHA blob of the file.
- branch str
- String
- Committer author name.
- commit
Email String - Committer email address.
- commit
Message String - Commit message when file was last updated.
- commit
Sha String - The SHA of the commit that modified the file.
- content String
- The file content.
- file String
- id String
- The provider-assigned unique ID for this managed resource.
- repository String
- sha String
- The SHA blob of the file.
- branch String
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
githubTerraform Provider.
Viewing docs for GitHub v4.17.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
