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
Use this data source to retrieve information about a single tree.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var thisRepository = Github.GetRepository.Invoke(new()
{
Name = "example",
});
var thisBranch = Github.GetBranch.Invoke(new()
{
Branch = thisRepository.Apply(getRepositoryResult => getRepositoryResult.DefaultBranch),
Repository = thisRepository.Apply(getRepositoryResult => getRepositoryResult.Name),
});
var thisTree = Github.GetTree.Invoke(new()
{
Recursive = false,
Repository = thisRepository.Apply(getRepositoryResult => getRepositoryResult.Name),
TreeSha = thisBranch.Apply(getBranchResult => getBranchResult.Sha),
});
return new Dictionary<string, object?>
{
["entries"] = thisTree.Apply(getTreeResult => getTreeResult.Entries),
};
});
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 {
thisRepository, err := github.LookupRepository(ctx, &GetRepositoryArgs{
Name: pulumi.StringRef("example"),
}, nil)
if err != nil {
return err
}
thisBranch, err := github.LookupBranch(ctx, &GetBranchArgs{
Branch: thisRepository.DefaultBranch,
Repository: thisRepository.Name,
}, nil)
if err != nil {
return err
}
thisTree, err := github.GetTree(ctx, &GetTreeArgs{
Recursive: pulumi.BoolRef(false),
Repository: thisRepository.Name,
TreeSha: thisBranch.Sha,
}, nil)
if err != nil {
return err
}
ctx.Export("entries", thisTree.Entries)
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.GetRepositoryArgs;
import com.pulumi.github.inputs.GetBranchArgs;
import com.pulumi.github.inputs.GetTreeArgs;
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 thisRepository = GithubFunctions.getRepository(GetRepositoryArgs.builder()
.name("example")
.build());
final var thisBranch = GithubFunctions.getBranch(GetBranchArgs.builder()
.branch(thisRepository.applyValue(getRepositoryResult -> getRepositoryResult.defaultBranch()))
.repository(thisRepository.applyValue(getRepositoryResult -> getRepositoryResult.name()))
.build());
final var thisTree = GithubFunctions.getTree(GetTreeArgs.builder()
.recursive(false)
.repository(thisRepository.applyValue(getRepositoryResult -> getRepositoryResult.name()))
.treeSha(thisBranch.applyValue(getBranchResult -> getBranchResult.sha()))
.build());
ctx.export("entries", thisTree.applyValue(getTreeResult -> getTreeResult.entries()));
}
}
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const thisRepository = github.getRepository({
name: "example",
});
const thisBranch = Promise.all([thisRepository, thisRepository]).then(([thisRepository, thisRepository1]) => github.getBranch({
branch: thisRepository.defaultBranch,
repository: thisRepository1.name,
}));
const thisTree = Promise.all([thisRepository, thisBranch]).then(([thisRepository, thisBranch]) => github.getTree({
recursive: false,
repository: thisRepository.name,
treeSha: thisBranch.sha,
}));
export const entries = thisTree.then(thisTree => thisTree.entries);
import pulumi
import pulumi_github as github
this_repository = github.get_repository(name="example")
this_branch = github.get_branch(branch=this_repository.default_branch,
repository=this_repository.name)
this_tree = github.get_tree(recursive=False,
repository=this_repository.name,
tree_sha=this_branch.sha)
pulumi.export("entries", this_tree.entries)
variables:
thisRepository:
Fn::Invoke:
Function: github:getRepository
Arguments:
name: example
thisBranch:
Fn::Invoke:
Function: github:getBranch
Arguments:
branch: ${thisRepository.defaultBranch}
repository: ${thisRepository.name}
thisTree:
Fn::Invoke:
Function: github:getTree
Arguments:
recursive: false
repository: ${thisRepository.name}
treeSha: ${thisBranch.sha}
outputs:
entries: ${thisTree.entries}
Using getTree
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 getTree(args: GetTreeArgs, opts?: InvokeOptions): Promise<GetTreeResult>
function getTreeOutput(args: GetTreeOutputArgs, opts?: InvokeOptions): Output<GetTreeResult>def get_tree(recursive: Optional[bool] = None,
repository: Optional[str] = None,
tree_sha: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetTreeResult
def get_tree_output(recursive: Optional[pulumi.Input[bool]] = None,
repository: Optional[pulumi.Input[str]] = None,
tree_sha: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetTreeResult]func GetTree(ctx *Context, args *GetTreeArgs, opts ...InvokeOption) (*GetTreeResult, error)
func GetTreeOutput(ctx *Context, args *GetTreeOutputArgs, opts ...InvokeOption) GetTreeResultOutput> Note: This function is named GetTree in the Go SDK.
public static class GetTree
{
public static Task<GetTreeResult> InvokeAsync(GetTreeArgs args, InvokeOptions? opts = null)
public static Output<GetTreeResult> Invoke(GetTreeInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetTreeResult> getTree(GetTreeArgs args, InvokeOptions options)
public static Output<GetTreeResult> getTree(GetTreeArgs args, InvokeOptions options)
fn::invoke:
function: github:index/getTree:getTree
arguments:
# arguments dictionaryThe following arguments are supported:
- Repository string
- The name of the repository.
- Tree
Sha string - The SHA1 value for the tree.
- Recursive bool
- Setting this parameter to
truereturns the objects or subtrees referenced by the tree specified intree_sha.
- Repository string
- The name of the repository.
- Tree
Sha string - The SHA1 value for the tree.
- Recursive bool
- Setting this parameter to
truereturns the objects or subtrees referenced by the tree specified intree_sha.
- repository String
- The name of the repository.
- tree
Sha String - The SHA1 value for the tree.
- recursive Boolean
- Setting this parameter to
truereturns the objects or subtrees referenced by the tree specified intree_sha.
- repository string
- The name of the repository.
- tree
Sha string - The SHA1 value for the tree.
- recursive boolean
- Setting this parameter to
truereturns the objects or subtrees referenced by the tree specified intree_sha.
- repository str
- The name of the repository.
- tree_
sha str - The SHA1 value for the tree.
- recursive bool
- Setting this parameter to
truereturns the objects or subtrees referenced by the tree specified intree_sha.
- repository String
- The name of the repository.
- tree
Sha String - The SHA1 value for the tree.
- recursive Boolean
- Setting this parameter to
truereturns the objects or subtrees referenced by the tree specified intree_sha.
getTree Result
The following output properties are available:
- Entries
List<Get
Tree Entry> - Objects (of
path,mode,type,size, andsha) specifying a tree structure. - Id string
- The provider-assigned unique ID for this managed resource.
- Repository string
- Tree
Sha string - Recursive bool
- Entries
[]Get
Tree Entry - Objects (of
path,mode,type,size, andsha) specifying a tree structure. - Id string
- The provider-assigned unique ID for this managed resource.
- Repository string
- Tree
Sha string - Recursive bool
- entries
List<Get
Tree Entry> - Objects (of
path,mode,type,size, andsha) specifying a tree structure. - id String
- The provider-assigned unique ID for this managed resource.
- repository String
- tree
Sha String - recursive Boolean
- entries
Get
Tree Entry[] - Objects (of
path,mode,type,size, andsha) specifying a tree structure. - id string
- The provider-assigned unique ID for this managed resource.
- repository string
- tree
Sha string - recursive boolean
- entries
Sequence[Get
Tree Entry] - Objects (of
path,mode,type,size, andsha) specifying a tree structure. - id str
- The provider-assigned unique ID for this managed resource.
- repository str
- tree_
sha str - recursive bool
- entries List<Property Map>
- Objects (of
path,mode,type,size, andsha) specifying a tree structure. - id String
- The provider-assigned unique ID for this managed resource.
- repository String
- tree
Sha String - recursive Boolean
Supporting Types
GetTreeEntry
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
