1. Packages
  2. Github Provider
  3. API Docs
  4. getRef
GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi

github.getRef

Explore with Pulumi AI

GitHub v6.7.0 published on Friday, Feb 28, 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",
});
Copy
import pulumi
import pulumi_github as github

development = github.get_ref(owner="example",
    repository="example",
    ref="heads/development")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
variables:
  development:
    fn::invoke:
      function: github:getRef
      arguments:
        owner: example
        repository: example
        ref: heads/development
Copy

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>
Copy
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]
Copy
func GetRef(ctx *Context, args *GetRefArgs, opts ...InvokeOption) (*GetRefResult, error)
func GetRefOutput(ctx *Context, args *GetRefOutputArgs, opts ...InvokeOption) GetRefResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetRefResult> getRef(GetRefArgs args, InvokeOptions options)
public static Output<GetRefResult> getRef(GetRefArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: github:index/getRef:getRef
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Ref
This property is required.
Changes to this property will trigger replacement.
string
The repository ref to look up. Must be formatted heads/<ref> for branches, and tags/<ref> for tags.
Repository
This property is required.
Changes to this property will trigger replacement.
string
The GitHub repository name.
Owner string
Owner of the repository.
Ref
This property is required.
Changes to this property will trigger replacement.
string
The repository ref to look up. Must be formatted heads/<ref> for branches, and tags/<ref> for tags.
Repository
This property is required.
Changes to this property will trigger replacement.
string
The GitHub repository name.
Owner string
Owner of the repository.
ref
This property is required.
Changes to this property will trigger replacement.
String
The repository ref to look up. Must be formatted heads/<ref> for branches, and tags/<ref> for tags.
repository
This property is required.
Changes to this property will trigger replacement.
String
The GitHub repository name.
owner String
Owner of the repository.
ref
This property is required.
Changes to this property will trigger replacement.
string
The repository ref to look up. Must be formatted heads/<ref> for branches, and tags/<ref> for tags.
repository
This property is required.
Changes to this property will trigger replacement.
string
The GitHub repository name.
owner string
Owner of the repository.
ref
This property is required.
Changes to this property will trigger replacement.
str
The repository ref to look up. Must be formatted heads/<ref> for branches, and tags/<ref> for tags.
repository
This property is required.
Changes to this property will trigger replacement.
str
The GitHub repository name.
owner str
Owner of the repository.
ref
This property is required.
Changes to this property will trigger replacement.
String
The repository ref to look up. Must be formatted heads/<ref> for branches, and tags/<ref> for tags.
repository
This property is required.
Changes to this property will trigger replacement.
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 v6.7.0 published on Friday, Feb 28, 2025 by Pulumi