GitHub v6.7.2 published on Wednesday, Apr 30, 2025 by Pulumi
github.getRef
Explore with Pulumi AI
Use this data source to retrieve information about a repository ref.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const development = github.getRef({
    owner: "example",
    repository: "example",
    ref: "heads/development",
});
import pulumi
import pulumi_github as github
development = github.get_ref(owner="example",
    repository="example",
    ref="heads/development")
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.GetRef(ctx, &github.GetRefArgs{
			Owner:      pulumi.StringRef("example"),
			Repository: "example",
			Ref:        "heads/development",
		}, 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 development = Github.GetRef.Invoke(new()
    {
        Owner = "example",
        Repository = "example",
        Ref = "heads/development",
    });
});
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.GetRefArgs;
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 development = GithubFunctions.getRef(GetRefArgs.builder()
            .owner("example")
            .repository("example")
            .ref("heads/development")
            .build());
    }
}
variables:
  development:
    fn::invoke:
      function: github:getRef
      arguments:
        owner: example
        repository: example
        ref: heads/development
Using getRef
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 getRef(args: GetRefArgs, opts?: InvokeOptions): Promise<GetRefResult>
function getRefOutput(args: GetRefOutputArgs, opts?: InvokeOptions): Output<GetRefResult>def get_ref(owner: Optional[str] = None,
            ref: Optional[str] = None,
            repository: Optional[str] = None,
            opts: Optional[InvokeOptions] = None) -> GetRefResult
def get_ref_output(owner: Optional[pulumi.Input[str]] = None,
            ref: Optional[pulumi.Input[str]] = None,
            repository: Optional[pulumi.Input[str]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetRefResult]func GetRef(ctx *Context, args *GetRefArgs, opts ...InvokeOption) (*GetRefResult, error)
func GetRefOutput(ctx *Context, args *GetRefOutputArgs, opts ...InvokeOption) GetRefResultOutput> Note: This function is named GetRef in the Go SDK.
public static class GetRef 
{
    public static Task<GetRefResult> InvokeAsync(GetRefArgs args, InvokeOptions? opts = null)
    public static Output<GetRefResult> Invoke(GetRefInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRefResult> getRef(GetRefArgs args, InvokeOptions options)
public static Output<GetRefResult> getRef(GetRefArgs args, InvokeOptions options)
fn::invoke:
  function: github:index/getRef:getRef
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Ref string
- The repository ref to look up. Must be formatted heads/<ref>for branches, andtags/<ref>for tags.
- Repository string
- The GitHub repository name.
- Owner string
- Owner of the repository.
- Ref string
- The repository ref to look up. Must be formatted heads/<ref>for branches, andtags/<ref>for tags.
- Repository string
- The GitHub repository name.
- Owner string
- Owner of the repository.
- ref String
- The repository ref to look up. Must be formatted heads/<ref>for branches, andtags/<ref>for tags.
- repository String
- The GitHub repository name.
- owner String
- Owner of the repository.
- ref string
- The repository ref to look up. Must be formatted heads/<ref>for branches, andtags/<ref>for tags.
- repository string
- The GitHub repository name.
- owner string
- Owner of the repository.
- ref str
- The repository ref to look up. Must be formatted heads/<ref>for branches, andtags/<ref>for tags.
- repository str
- The GitHub repository name.
- owner str
- Owner of the repository.
- ref String
- The repository ref to look up. Must be formatted heads/<ref>for branches, andtags/<ref>for tags.
- repository String
- The GitHub repository name.
- owner String
- Owner of the repository.
getRef Result
The following output properties are available:
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the githubTerraform Provider.