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

github.RepositoryTopics

Explore with Pulumi AI

Example Usage

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

const test = github.getRepository({
    name: "test",
});
const testRepositoryTopics = new github.RepositoryTopics("test", {
    repository: testGithubRepository.name,
    topics: [
        "topic-1",
        "topic-2",
    ],
});
Copy
import pulumi
import pulumi_github as github

test = github.get_repository(name="test")
test_repository_topics = github.RepositoryTopics("test",
    repository=test_github_repository["name"],
    topics=[
        "topic-1",
        "topic-2",
    ])
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.LookupRepository(ctx, &github.LookupRepositoryArgs{
			Name: pulumi.StringRef("test"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = github.NewRepositoryTopics(ctx, "test", &github.RepositoryTopicsArgs{
			Repository: pulumi.Any(testGithubRepository.Name),
			Topics: pulumi.StringArray{
				pulumi.String("topic-1"),
				pulumi.String("topic-2"),
			},
		})
		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 test = Github.GetRepository.Invoke(new()
    {
        Name = "test",
    });

    var testRepositoryTopics = new Github.RepositoryTopics("test", new()
    {
        Repository = testGithubRepository.Name,
        Topics = new[]
        {
            "topic-1",
            "topic-2",
        },
    });

});
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.GetRepositoryArgs;
import com.pulumi.github.RepositoryTopics;
import com.pulumi.github.RepositoryTopicsArgs;
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 test = GithubFunctions.getRepository(GetRepositoryArgs.builder()
            .name("test")
            .build());

        var testRepositoryTopics = new RepositoryTopics("testRepositoryTopics", RepositoryTopicsArgs.builder()
            .repository(testGithubRepository.name())
            .topics(            
                "topic-1",
                "topic-2")
            .build());

    }
}
Copy
resources:
  testRepositoryTopics:
    type: github:RepositoryTopics
    name: test
    properties:
      repository: ${testGithubRepository.name}
      topics:
        - topic-1
        - topic-2
variables:
  test:
    fn::invoke:
      function: github:getRepository
      arguments:
        name: test
Copy

Create RepositoryTopics Resource

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

Constructor syntax

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

@overload
def RepositoryTopics(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     repository: Optional[str] = None,
                     topics: Optional[Sequence[str]] = None)
func NewRepositoryTopics(ctx *Context, name string, args RepositoryTopicsArgs, opts ...ResourceOption) (*RepositoryTopics, error)
public RepositoryTopics(string name, RepositoryTopicsArgs args, CustomResourceOptions? opts = null)
public RepositoryTopics(String name, RepositoryTopicsArgs args)
public RepositoryTopics(String name, RepositoryTopicsArgs args, CustomResourceOptions options)
type: github:RepositoryTopics
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. RepositoryTopicsArgs
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. RepositoryTopicsArgs
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. RepositoryTopicsArgs
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. RepositoryTopicsArgs
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. RepositoryTopicsArgs
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 repositoryTopicsResource = new Github.RepositoryTopics("repositoryTopicsResource", new()
{
    Repository = "string",
    Topics = new[]
    {
        "string",
    },
});
Copy
example, err := github.NewRepositoryTopics(ctx, "repositoryTopicsResource", &github.RepositoryTopicsArgs{
	Repository: pulumi.String("string"),
	Topics: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var repositoryTopicsResource = new RepositoryTopics("repositoryTopicsResource", RepositoryTopicsArgs.builder()
    .repository("string")
    .topics("string")
    .build());
Copy
repository_topics_resource = github.RepositoryTopics("repositoryTopicsResource",
    repository="string",
    topics=["string"])
Copy
const repositoryTopicsResource = new github.RepositoryTopics("repositoryTopicsResource", {
    repository: "string",
    topics: ["string"],
});
Copy
type: github:RepositoryTopics
properties:
    repository: string
    topics:
        - string
Copy

RepositoryTopics 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 RepositoryTopics resource accepts the following input properties:

Repository This property is required. string
The repository name.
Topics This property is required. List<string>
A list of topics to add to the repository.
Repository This property is required. string
The repository name.
Topics This property is required. []string
A list of topics to add to the repository.
repository This property is required. String
The repository name.
topics This property is required. List<String>
A list of topics to add to the repository.
repository This property is required. string
The repository name.
topics This property is required. string[]
A list of topics to add to the repository.
repository This property is required. str
The repository name.
topics This property is required. Sequence[str]
A list of topics to add to the repository.
repository This property is required. String
The repository name.
topics This property is required. List<String>
A list of topics to add to the repository.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing RepositoryTopics Resource

Get an existing RepositoryTopics 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?: RepositoryTopicsState, opts?: CustomResourceOptions): RepositoryTopics
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        repository: Optional[str] = None,
        topics: Optional[Sequence[str]] = None) -> RepositoryTopics
func GetRepositoryTopics(ctx *Context, name string, id IDInput, state *RepositoryTopicsState, opts ...ResourceOption) (*RepositoryTopics, error)
public static RepositoryTopics Get(string name, Input<string> id, RepositoryTopicsState? state, CustomResourceOptions? opts = null)
public static RepositoryTopics get(String name, Output<String> id, RepositoryTopicsState state, CustomResourceOptions options)
resources:  _:    type: github:RepositoryTopics    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:
Repository string
The repository name.
Topics List<string>
A list of topics to add to the repository.
Repository string
The repository name.
Topics []string
A list of topics to add to the repository.
repository String
The repository name.
topics List<String>
A list of topics to add to the repository.
repository string
The repository name.
topics string[]
A list of topics to add to the repository.
repository str
The repository name.
topics Sequence[str]
A list of topics to add to the repository.
repository String
The repository name.
topics List<String>
A list of topics to add to the repository.

Import

Repository topics can be imported using the name of the repository.

$ pulumi import github:index/repositoryTopics:RepositoryTopics terraform terraform
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.