github logo
GitHub v5.10.0, Jun 2 23

github.getRef

Explore with Pulumi AI

Use this data source to retrieve information about a repository ref.

Example Usage

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",
        Ref = "heads/development",
        Repository = "example",
    });

});
package main

import (
	"github.com/pulumi/pulumi-github/sdk/v5/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"),
			Ref:        "heads/development",
			Repository: "example",
		}, 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.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")
            .ref("heads/development")
            .repository("example")
            .build());

    }
}
import pulumi
import pulumi_github as github

development = github.get_ref(owner="example",
    ref="heads/development",
    repository="example")
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const development = github.getRef({
    owner: "example",
    ref: "heads/development",
    repository: "example",
});
variables:
  development:
    fn::invoke:
      Function: github:getRef
      Arguments:
        owner: example
        ref: heads/development
        repository: example

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)
// Output-based functions aren't available in Java yet
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.