GitHub v6.3.0 published on Monday, Sep 16, 2024 by Pulumi
github.getRepositoryFile
Explore with Pulumi AI
This data source allows you to read files within a GitHub repository.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const foo = github.getRepositoryFile({
repository: fooGithubRepository.name,
branch: "main",
file: ".gitignore",
});
import pulumi
import pulumi_github as github
foo = github.get_repository_file(repository=foo_github_repository["name"],
branch="main",
file=".gitignore")
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 {
_, err := github.LookupRepositoryFile(ctx, &github.LookupRepositoryFileArgs{
Repository: fooGithubRepository.Name,
Branch: pulumi.StringRef("main"),
File: ".gitignore",
}, nil)
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 = Github.GetRepositoryFile.Invoke(new()
{
Repository = fooGithubRepository.Name,
Branch = "main",
File = ".gitignore",
});
});
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(fooGithubRepository.name())
.branch("main")
.file(".gitignore")
.build());
}
}
variables:
foo:
fn::invoke:
Function: github:getRepositoryFile
Arguments:
repository: ${fooGithubRepository.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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: github:index/getRepositoryFile:getRepositoryFile
arguments:
# arguments dictionary
The following arguments are supported:
- File string
- The path of the file to read.
- Repository string
- The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token.
- Branch string
- Git branch. Defaults to the repository's default branch.
- File string
- The path of the file to read.
- Repository string
- The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token.
- Branch string
- Git branch. Defaults to the repository's default branch.
- file String
- The path of the file to read.
- repository String
- The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token.
- branch String
- Git branch. Defaults to the repository's default branch.
- file string
- The path of the file to read.
- repository string
- The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token.
- branch string
- Git branch. Defaults to the repository's default branch.
- file str
- The path of the file to read.
- repository str
- The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token.
- branch str
- Git branch. Defaults to the repository's default branch.
- file String
- The path of the file to read.
- repository String
- The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token.
- branch String
- Git branch. Defaults to the repository's default branch.
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.
- Ref string
- The name of the commit/branch/tag.
- 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.
- Ref string
- The name of the commit/branch/tag.
- 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.
- ref String
- The name of the commit/branch/tag.
- 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.
- ref string
- The name of the commit/branch/tag.
- 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.
- ref str
- The name of the commit/branch/tag.
- 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.
- ref String
- The name of the commit/branch/tag.
- 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
github
Terraform Provider.