1. Packages
  2. Github Provider
  3. API Docs
  4. getRef
GitHub v6.8.1 published on Saturday, Nov 1, 2025 by Pulumi

github.getRef

Start a Neo task
Explain and create a github.getRef resource
github logo
GitHub v6.8.1 published on Saturday, Nov 1, 2025 by Pulumi

    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 dictionary

    The following arguments are supported:

    Ref string
    The repository ref to look up. Must be formatted heads/<ref> for branches, and tags/<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, and tags/<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, and tags/<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, and tags/<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, and tags/<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, and tags/<ref> for tags.
    repository String
    The GitHub repository name.
    owner String
    Owner of the repository.

    getRef Result

    The following output properties are available:

    Etag string
    An etag representing the ref.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ref string
    Repository string
    Sha string
    A string storing the reference's HEAD commit's SHA1.
    Owner string
    Etag string
    An etag representing the ref.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ref string
    Repository string
    Sha string
    A string storing the reference's HEAD commit's SHA1.
    Owner string
    etag String
    An etag representing the ref.
    id String
    The provider-assigned unique ID for this managed resource.
    ref String
    repository String
    sha String
    A string storing the reference's HEAD commit's SHA1.
    owner String
    etag string
    An etag representing the ref.
    id string
    The provider-assigned unique ID for this managed resource.
    ref string
    repository string
    sha string
    A string storing the reference's HEAD commit's SHA1.
    owner string
    etag str
    An etag representing the ref.
    id str
    The provider-assigned unique ID for this managed resource.
    ref str
    repository str
    sha str
    A string storing the reference's HEAD commit's SHA1.
    owner str
    etag String
    An etag representing the ref.
    id String
    The provider-assigned unique ID for this managed resource.
    ref String
    repository String
    sha String
    A string storing the reference's HEAD commit's SHA1.
    owner String

    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.8.1 published on Saturday, Nov 1, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate