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

github.RepositoryAutolinkReference

Explore with Pulumi AI

This resource allows you to create and manage an autolink reference for a single repository.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const repo = new github.Repository("repo", {
    name: "my-repo",
    description: "GitHub repo managed by Terraform",
    "private": false,
});
const autolink = new github.RepositoryAutolinkReference("autolink", {
    repository: repo.name,
    keyPrefix: "TICKET-",
    targetUrlTemplate: "https://example.com/TICKET?query=<num>",
});
Copy
import pulumi
import pulumi_github as github

repo = github.Repository("repo",
    name="my-repo",
    description="GitHub repo managed by Terraform",
    private=False)
autolink = github.RepositoryAutolinkReference("autolink",
    repository=repo.name,
    key_prefix="TICKET-",
    target_url_template="https://example.com/TICKET?query=<num>")
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 {
		repo, err := github.NewRepository(ctx, "repo", &github.RepositoryArgs{
			Name:        pulumi.String("my-repo"),
			Description: pulumi.String("GitHub repo managed by Terraform"),
			Private:     pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		_, err = github.NewRepositoryAutolinkReference(ctx, "autolink", &github.RepositoryAutolinkReferenceArgs{
			Repository:        repo.Name,
			KeyPrefix:         pulumi.String("TICKET-"),
			TargetUrlTemplate: pulumi.String("https://example.com/TICKET?query=<num>"),
		})
		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 repo = new Github.Repository("repo", new()
    {
        Name = "my-repo",
        Description = "GitHub repo managed by Terraform",
        Private = false,
    });

    var autolink = new Github.RepositoryAutolinkReference("autolink", new()
    {
        Repository = repo.Name,
        KeyPrefix = "TICKET-",
        TargetUrlTemplate = "https://example.com/TICKET?query=<num>",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.RepositoryAutolinkReference;
import com.pulumi.github.RepositoryAutolinkReferenceArgs;
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) {
        var repo = new Repository("repo", RepositoryArgs.builder()
            .name("my-repo")
            .description("GitHub repo managed by Terraform")
            .private_(false)
            .build());

        var autolink = new RepositoryAutolinkReference("autolink", RepositoryAutolinkReferenceArgs.builder()
            .repository(repo.name())
            .keyPrefix("TICKET-")
            .targetUrlTemplate("https://example.com/TICKET?query=<num>")
            .build());

    }
}
Copy
resources:
  repo:
    type: github:Repository
    properties:
      name: my-repo
      description: GitHub repo managed by Terraform
      private: false
  autolink:
    type: github:RepositoryAutolinkReference
    properties:
      repository: ${repo.name}
      keyPrefix: TICKET-
      targetUrlTemplate: https://example.com/TICKET?query=<num>
Copy

Create RepositoryAutolinkReference Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RepositoryAutolinkReference(name: string, args: RepositoryAutolinkReferenceArgs, opts?: CustomResourceOptions);
@overload
def RepositoryAutolinkReference(resource_name: str,
                                args: RepositoryAutolinkReferenceArgs,
                                opts: Optional[ResourceOptions] = None)

@overload
def RepositoryAutolinkReference(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                key_prefix: Optional[str] = None,
                                repository: Optional[str] = None,
                                target_url_template: Optional[str] = None,
                                is_alphanumeric: Optional[bool] = None)
func NewRepositoryAutolinkReference(ctx *Context, name string, args RepositoryAutolinkReferenceArgs, opts ...ResourceOption) (*RepositoryAutolinkReference, error)
public RepositoryAutolinkReference(string name, RepositoryAutolinkReferenceArgs args, CustomResourceOptions? opts = null)
public RepositoryAutolinkReference(String name, RepositoryAutolinkReferenceArgs args)
public RepositoryAutolinkReference(String name, RepositoryAutolinkReferenceArgs args, CustomResourceOptions options)
type: github:RepositoryAutolinkReference
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RepositoryAutolinkReferenceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RepositoryAutolinkReferenceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryAutolinkReferenceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryAutolinkReferenceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RepositoryAutolinkReferenceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var repositoryAutolinkReferenceResource = new Github.RepositoryAutolinkReference("repositoryAutolinkReferenceResource", new()
{
    KeyPrefix = "string",
    Repository = "string",
    TargetUrlTemplate = "string",
    IsAlphanumeric = false,
});
Copy
example, err := github.NewRepositoryAutolinkReference(ctx, "repositoryAutolinkReferenceResource", &github.RepositoryAutolinkReferenceArgs{
	KeyPrefix:         pulumi.String("string"),
	Repository:        pulumi.String("string"),
	TargetUrlTemplate: pulumi.String("string"),
	IsAlphanumeric:    pulumi.Bool(false),
})
Copy
var repositoryAutolinkReferenceResource = new RepositoryAutolinkReference("repositoryAutolinkReferenceResource", RepositoryAutolinkReferenceArgs.builder()
    .keyPrefix("string")
    .repository("string")
    .targetUrlTemplate("string")
    .isAlphanumeric(false)
    .build());
Copy
repository_autolink_reference_resource = github.RepositoryAutolinkReference("repositoryAutolinkReferenceResource",
    key_prefix="string",
    repository="string",
    target_url_template="string",
    is_alphanumeric=False)
Copy
const repositoryAutolinkReferenceResource = new github.RepositoryAutolinkReference("repositoryAutolinkReferenceResource", {
    keyPrefix: "string",
    repository: "string",
    targetUrlTemplate: "string",
    isAlphanumeric: false,
});
Copy
type: github:RepositoryAutolinkReference
properties:
    isAlphanumeric: false
    keyPrefix: string
    repository: string
    targetUrlTemplate: string
Copy

RepositoryAutolinkReference Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RepositoryAutolinkReference resource accepts the following input properties:

KeyPrefix
This property is required.
Changes to this property will trigger replacement.
string
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
Repository
This property is required.
Changes to this property will trigger replacement.
string
The repository of the autolink reference.
TargetUrlTemplate
This property is required.
Changes to this property will trigger replacement.
string
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
IsAlphanumeric Changes to this property will trigger replacement. bool
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
KeyPrefix
This property is required.
Changes to this property will trigger replacement.
string
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
Repository
This property is required.
Changes to this property will trigger replacement.
string
The repository of the autolink reference.
TargetUrlTemplate
This property is required.
Changes to this property will trigger replacement.
string
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
IsAlphanumeric Changes to this property will trigger replacement. bool
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
keyPrefix
This property is required.
Changes to this property will trigger replacement.
String
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
repository
This property is required.
Changes to this property will trigger replacement.
String
The repository of the autolink reference.
targetUrlTemplate
This property is required.
Changes to this property will trigger replacement.
String
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
isAlphanumeric Changes to this property will trigger replacement. Boolean
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
keyPrefix
This property is required.
Changes to this property will trigger replacement.
string
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
repository
This property is required.
Changes to this property will trigger replacement.
string
The repository of the autolink reference.
targetUrlTemplate
This property is required.
Changes to this property will trigger replacement.
string
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
isAlphanumeric Changes to this property will trigger replacement. boolean
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
key_prefix
This property is required.
Changes to this property will trigger replacement.
str
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
repository
This property is required.
Changes to this property will trigger replacement.
str
The repository of the autolink reference.
target_url_template
This property is required.
Changes to this property will trigger replacement.
str
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
is_alphanumeric Changes to this property will trigger replacement. bool
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
keyPrefix
This property is required.
Changes to this property will trigger replacement.
String
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
repository
This property is required.
Changes to this property will trigger replacement.
String
The repository of the autolink reference.
targetUrlTemplate
This property is required.
Changes to this property will trigger replacement.
String
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
isAlphanumeric Changes to this property will trigger replacement. Boolean
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.

Outputs

All input properties are implicitly available as output properties. Additionally, the RepositoryAutolinkReference resource produces the following output properties:

Etag string
An etag representing the autolink reference object.
Id string
The provider-assigned unique ID for this managed resource.
Etag string
An etag representing the autolink reference object.
Id string
The provider-assigned unique ID for this managed resource.
etag String
An etag representing the autolink reference object.
id String
The provider-assigned unique ID for this managed resource.
etag string
An etag representing the autolink reference object.
id string
The provider-assigned unique ID for this managed resource.
etag str
An etag representing the autolink reference object.
id str
The provider-assigned unique ID for this managed resource.
etag String
An etag representing the autolink reference object.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing RepositoryAutolinkReference Resource

Get an existing RepositoryAutolinkReference resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RepositoryAutolinkReferenceState, opts?: CustomResourceOptions): RepositoryAutolinkReference
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        etag: Optional[str] = None,
        is_alphanumeric: Optional[bool] = None,
        key_prefix: Optional[str] = None,
        repository: Optional[str] = None,
        target_url_template: Optional[str] = None) -> RepositoryAutolinkReference
func GetRepositoryAutolinkReference(ctx *Context, name string, id IDInput, state *RepositoryAutolinkReferenceState, opts ...ResourceOption) (*RepositoryAutolinkReference, error)
public static RepositoryAutolinkReference Get(string name, Input<string> id, RepositoryAutolinkReferenceState? state, CustomResourceOptions? opts = null)
public static RepositoryAutolinkReference get(String name, Output<String> id, RepositoryAutolinkReferenceState state, CustomResourceOptions options)
resources:  _:    type: github:RepositoryAutolinkReference    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Etag string
An etag representing the autolink reference object.
IsAlphanumeric Changes to this property will trigger replacement. bool
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
KeyPrefix Changes to this property will trigger replacement. string
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
Repository Changes to this property will trigger replacement. string
The repository of the autolink reference.
TargetUrlTemplate Changes to this property will trigger replacement. string
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
Etag string
An etag representing the autolink reference object.
IsAlphanumeric Changes to this property will trigger replacement. bool
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
KeyPrefix Changes to this property will trigger replacement. string
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
Repository Changes to this property will trigger replacement. string
The repository of the autolink reference.
TargetUrlTemplate Changes to this property will trigger replacement. string
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
etag String
An etag representing the autolink reference object.
isAlphanumeric Changes to this property will trigger replacement. Boolean
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
keyPrefix Changes to this property will trigger replacement. String
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
repository Changes to this property will trigger replacement. String
The repository of the autolink reference.
targetUrlTemplate Changes to this property will trigger replacement. String
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
etag string
An etag representing the autolink reference object.
isAlphanumeric Changes to this property will trigger replacement. boolean
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
keyPrefix Changes to this property will trigger replacement. string
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
repository Changes to this property will trigger replacement. string
The repository of the autolink reference.
targetUrlTemplate Changes to this property will trigger replacement. string
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
etag str
An etag representing the autolink reference object.
is_alphanumeric Changes to this property will trigger replacement. bool
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
key_prefix Changes to this property will trigger replacement. str
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
repository Changes to this property will trigger replacement. str
The repository of the autolink reference.
target_url_template Changes to this property will trigger replacement. str
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number
etag String
An etag representing the autolink reference object.
isAlphanumeric Changes to this property will trigger replacement. Boolean
Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true.
keyPrefix Changes to this property will trigger replacement. String
This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit.
repository Changes to this property will trigger replacement. String
The repository of the autolink reference.
targetUrlTemplate Changes to this property will trigger replacement. String
The template of the target URL used for the links; must be a valid URL and contain <num> for the reference number

Import

Import by key prefix

$ pulumi import github:index/repositoryAutolinkReference:RepositoryAutolinkReference auto oof/OOF-
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
GitHub pulumi/pulumi-github
License
Apache-2.0
Notes
This Pulumi package is based on the github Terraform Provider.