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

github.IssueLabel

Explore with Pulumi AI

Provides a GitHub issue label resource.

This resource allows you to create and manage issue labels within your GitHub organization.

Issue labels are keyed off of their “name”, so pre-existing issue labels result in a 422 HTTP error if they exist outside of Pulumi. Normally this would not be an issue, except new repositories are created with a “default” set of labels, and those labels easily conflict with custom ones.

This resource will first check if the label exists, and then issue an update, otherwise it will create.

Example Usage

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

// Create a new, red colored label
const testRepo = new github.IssueLabel("test_repo", {
    repository: "test-repo",
    name: "Urgent",
    color: "FF0000",
});
Copy
import pulumi
import pulumi_github as github

# Create a new, red colored label
test_repo = github.IssueLabel("test_repo",
    repository="test-repo",
    name="Urgent",
    color="FF0000")
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 {
		// Create a new, red colored label
		_, err := github.NewIssueLabel(ctx, "test_repo", &github.IssueLabelArgs{
			Repository: pulumi.String("test-repo"),
			Name:       pulumi.String("Urgent"),
			Color:      pulumi.String("FF0000"),
		})
		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(() => 
{
    // Create a new, red colored label
    var testRepo = new Github.IssueLabel("test_repo", new()
    {
        Repository = "test-repo",
        Name = "Urgent",
        Color = "FF0000",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.IssueLabel;
import com.pulumi.github.IssueLabelArgs;
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) {
        // Create a new, red colored label
        var testRepo = new IssueLabel("testRepo", IssueLabelArgs.builder()
            .repository("test-repo")
            .name("Urgent")
            .color("FF0000")
            .build());

    }
}
Copy
resources:
  # Create a new, red colored label
  testRepo:
    type: github:IssueLabel
    name: test_repo
    properties:
      repository: test-repo
      name: Urgent
      color: FF0000
Copy

Create IssueLabel Resource

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

Constructor syntax

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

@overload
def IssueLabel(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               color: Optional[str] = None,
               repository: Optional[str] = None,
               description: Optional[str] = None,
               name: Optional[str] = None)
func NewIssueLabel(ctx *Context, name string, args IssueLabelArgs, opts ...ResourceOption) (*IssueLabel, error)
public IssueLabel(string name, IssueLabelArgs args, CustomResourceOptions? opts = null)
public IssueLabel(String name, IssueLabelArgs args)
public IssueLabel(String name, IssueLabelArgs args, CustomResourceOptions options)
type: github:IssueLabel
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. IssueLabelArgs
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. IssueLabelArgs
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. IssueLabelArgs
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. IssueLabelArgs
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. IssueLabelArgs
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 issueLabelResource = new Github.IssueLabel("issueLabelResource", new()
{
    Color = "string",
    Repository = "string",
    Description = "string",
    Name = "string",
});
Copy
example, err := github.NewIssueLabel(ctx, "issueLabelResource", &github.IssueLabelArgs{
	Color:       pulumi.String("string"),
	Repository:  pulumi.String("string"),
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
})
Copy
var issueLabelResource = new IssueLabel("issueLabelResource", IssueLabelArgs.builder()
    .color("string")
    .repository("string")
    .description("string")
    .name("string")
    .build());
Copy
issue_label_resource = github.IssueLabel("issueLabelResource",
    color="string",
    repository="string",
    description="string",
    name="string")
Copy
const issueLabelResource = new github.IssueLabel("issueLabelResource", {
    color: "string",
    repository: "string",
    description: "string",
    name: "string",
});
Copy
type: github:IssueLabel
properties:
    color: string
    description: string
    name: string
    repository: string
Copy

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

Color This property is required. string
A 6 character hex code, without the leading #, identifying the color of the label.
Repository
This property is required.
Changes to this property will trigger replacement.
string
The GitHub repository
Description string
A short description of the label.
Name string
The name of the label.
Color This property is required. string
A 6 character hex code, without the leading #, identifying the color of the label.
Repository
This property is required.
Changes to this property will trigger replacement.
string
The GitHub repository
Description string
A short description of the label.
Name string
The name of the label.
color This property is required. String
A 6 character hex code, without the leading #, identifying the color of the label.
repository
This property is required.
Changes to this property will trigger replacement.
String
The GitHub repository
description String
A short description of the label.
name String
The name of the label.
color This property is required. string
A 6 character hex code, without the leading #, identifying the color of the label.
repository
This property is required.
Changes to this property will trigger replacement.
string
The GitHub repository
description string
A short description of the label.
name string
The name of the label.
color This property is required. str
A 6 character hex code, without the leading #, identifying the color of the label.
repository
This property is required.
Changes to this property will trigger replacement.
str
The GitHub repository
description str
A short description of the label.
name str
The name of the label.
color This property is required. String
A 6 character hex code, without the leading #, identifying the color of the label.
repository
This property is required.
Changes to this property will trigger replacement.
String
The GitHub repository
description String
A short description of the label.
name String
The name of the label.

Outputs

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

Etag string
Id string
The provider-assigned unique ID for this managed resource.
Url string
The URL to the issue label
Etag string
Id string
The provider-assigned unique ID for this managed resource.
Url string
The URL to the issue label
etag String
id String
The provider-assigned unique ID for this managed resource.
url String
The URL to the issue label
etag string
id string
The provider-assigned unique ID for this managed resource.
url string
The URL to the issue label
etag str
id str
The provider-assigned unique ID for this managed resource.
url str
The URL to the issue label
etag String
id String
The provider-assigned unique ID for this managed resource.
url String
The URL to the issue label

Look up Existing IssueLabel Resource

Get an existing IssueLabel 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?: IssueLabelState, opts?: CustomResourceOptions): IssueLabel
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        color: Optional[str] = None,
        description: Optional[str] = None,
        etag: Optional[str] = None,
        name: Optional[str] = None,
        repository: Optional[str] = None,
        url: Optional[str] = None) -> IssueLabel
func GetIssueLabel(ctx *Context, name string, id IDInput, state *IssueLabelState, opts ...ResourceOption) (*IssueLabel, error)
public static IssueLabel Get(string name, Input<string> id, IssueLabelState? state, CustomResourceOptions? opts = null)
public static IssueLabel get(String name, Output<String> id, IssueLabelState state, CustomResourceOptions options)
resources:  _:    type: github:IssueLabel    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:
Color string
A 6 character hex code, without the leading #, identifying the color of the label.
Description string
A short description of the label.
Etag string
Name string
The name of the label.
Repository Changes to this property will trigger replacement. string
The GitHub repository
Url string
The URL to the issue label
Color string
A 6 character hex code, without the leading #, identifying the color of the label.
Description string
A short description of the label.
Etag string
Name string
The name of the label.
Repository Changes to this property will trigger replacement. string
The GitHub repository
Url string
The URL to the issue label
color String
A 6 character hex code, without the leading #, identifying the color of the label.
description String
A short description of the label.
etag String
name String
The name of the label.
repository Changes to this property will trigger replacement. String
The GitHub repository
url String
The URL to the issue label
color string
A 6 character hex code, without the leading #, identifying the color of the label.
description string
A short description of the label.
etag string
name string
The name of the label.
repository Changes to this property will trigger replacement. string
The GitHub repository
url string
The URL to the issue label
color str
A 6 character hex code, without the leading #, identifying the color of the label.
description str
A short description of the label.
etag str
name str
The name of the label.
repository Changes to this property will trigger replacement. str
The GitHub repository
url str
The URL to the issue label
color String
A 6 character hex code, without the leading #, identifying the color of the label.
description String
A short description of the label.
etag String
name String
The name of the label.
repository Changes to this property will trigger replacement. String
The GitHub repository
url String
The URL to the issue label

Import

GitHub Issue Labels can be imported using an ID made up of repository:name, e.g.

$ pulumi import github:index/issueLabel:IssueLabel panic_label terraform:panic
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.