1. Packages
  2. GitHub
  3. API Docs
  4. Issue
GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi

github.Issue

Explore with Pulumi AI

github logo
GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi

    Provides a GitHub issue resource.

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    // Create a simple issue
    const test = new github.Repository("test", {
        name: "tf-acc-test-%s",
        autoInit: true,
        hasIssues: true,
    });
    const testIssue = new github.Issue("test", {
        repository: test.name,
        title: "My issue title",
        body: "The body of my issue",
    });
    
    import pulumi
    import pulumi_github as github
    
    # Create a simple issue
    test = github.Repository("test",
        name="tf-acc-test-%s",
        auto_init=True,
        has_issues=True)
    test_issue = github.Issue("test",
        repository=test.name,
        title="My issue title",
        body="The body of my issue")
    
    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 simple issue
    		test, err := github.NewRepository(ctx, "test", &github.RepositoryArgs{
    			Name:      pulumi.String("tf-acc-test-%s"),
    			AutoInit:  pulumi.Bool(true),
    			HasIssues: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewIssue(ctx, "test", &github.IssueArgs{
    			Repository: test.Name,
    			Title:      pulumi.String("My issue title"),
    			Body:       pulumi.String("The body of my issue"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a simple issue
        var test = new Github.Repository("test", new()
        {
            Name = "tf-acc-test-%s",
            AutoInit = true,
            HasIssues = true,
        });
    
        var testIssue = new Github.Issue("test", new()
        {
            Repository = test.Name,
            Title = "My issue title",
            Body = "The body of my issue",
        });
    
    });
    
    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.Issue;
    import com.pulumi.github.IssueArgs;
    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 simple issue
            var test = new Repository("test", RepositoryArgs.builder()
                .name("tf-acc-test-%s")
                .autoInit(true)
                .hasIssues(true)
                .build());
    
            var testIssue = new Issue("testIssue", IssueArgs.builder()
                .repository(test.name())
                .title("My issue title")
                .body("The body of my issue")
                .build());
    
        }
    }
    
    resources:
      # Create a simple issue
      test:
        type: github:Repository
        properties:
          name: tf-acc-test-%s
          autoInit: true
          hasIssues: true
      testIssue:
        type: github:Issue
        name: test
        properties:
          repository: ${test.name}
          title: My issue title
          body: The body of my issue
    

    With Milestone And Project Assignment

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    import * as std from "@pulumi/std";
    
    // Create an issue with milestone and project assignment
    const test = new github.Repository("test", {
        name: "tf-acc-test-%s",
        autoInit: true,
        hasIssues: true,
    });
    const testRepositoryMilestone = new github.RepositoryMilestone("test", {
        owner: std.splitOutput({
            separator: "/",
            text: test.fullName,
        }).apply(invoke => invoke.result?.[0]),
        repository: test.name,
        title: "v1.0.0",
        description: "General Availability",
        dueDate: "2022-11-22",
        state: "open",
    });
    const testIssue = new github.Issue("test", {
        repository: test.name,
        title: "My issue",
        body: "My issue body",
        labels: [
            "bug",
            "documentation",
        ],
        assignees: ["bob-github"],
        milestoneNumber: testRepositoryMilestone.number,
    });
    
    import pulumi
    import pulumi_github as github
    import pulumi_std as std
    
    # Create an issue with milestone and project assignment
    test = github.Repository("test",
        name="tf-acc-test-%s",
        auto_init=True,
        has_issues=True)
    test_repository_milestone = github.RepositoryMilestone("test",
        owner=std.split_output(separator="/",
            text=test.full_name).apply(lambda invoke: invoke.result[0]),
        repository=test.name,
        title="v1.0.0",
        description="General Availability",
        due_date="2022-11-22",
        state="open")
    test_issue = github.Issue("test",
        repository=test.name,
        title="My issue",
        body="My issue body",
        labels=[
            "bug",
            "documentation",
        ],
        assignees=["bob-github"],
        milestone_number=test_repository_milestone.number)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create an issue with milestone and project assignment
    		test, err := github.NewRepository(ctx, "test", &github.RepositoryArgs{
    			Name:      pulumi.String("tf-acc-test-%s"),
    			AutoInit:  pulumi.Bool(true),
    			HasIssues: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		testRepositoryMilestone, err := github.NewRepositoryMilestone(ctx, "test", &github.RepositoryMilestoneArgs{
    			Owner: std.SplitOutput(ctx, std.SplitOutputArgs{
    				Separator: pulumi.String("/"),
    				Text:      test.FullName,
    			}, nil).ApplyT(func(invoke std.SplitResult) (*string, error) {
    				return invoke.Result[0], nil
    			}).(pulumi.StringPtrOutput),
    			Repository:  test.Name,
    			Title:       pulumi.String("v1.0.0"),
    			Description: pulumi.String("General Availability"),
    			DueDate:     pulumi.String("2022-11-22"),
    			State:       pulumi.String("open"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewIssue(ctx, "test", &github.IssueArgs{
    			Repository: test.Name,
    			Title:      pulumi.String("My issue"),
    			Body:       pulumi.String("My issue body"),
    			Labels: pulumi.StringArray{
    				pulumi.String("bug"),
    				pulumi.String("documentation"),
    			},
    			Assignees: pulumi.StringArray{
    				pulumi.String("bob-github"),
    			},
    			MilestoneNumber: testRepositoryMilestone.Number,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        // Create an issue with milestone and project assignment
        var test = new Github.Repository("test", new()
        {
            Name = "tf-acc-test-%s",
            AutoInit = true,
            HasIssues = true,
        });
    
        var testRepositoryMilestone = new Github.RepositoryMilestone("test", new()
        {
            Owner = Std.Split.Invoke(new()
            {
                Separator = "/",
                Text = test.FullName,
            }).Apply(invoke => invoke.Result[0]),
            Repository = test.Name,
            Title = "v1.0.0",
            Description = "General Availability",
            DueDate = "2022-11-22",
            State = "open",
        });
    
        var testIssue = new Github.Issue("test", new()
        {
            Repository = test.Name,
            Title = "My issue",
            Body = "My issue body",
            Labels = new[]
            {
                "bug",
                "documentation",
            },
            Assignees = new[]
            {
                "bob-github",
            },
            MilestoneNumber = testRepositoryMilestone.Number,
        });
    
    });
    
    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.RepositoryMilestone;
    import com.pulumi.github.RepositoryMilestoneArgs;
    import com.pulumi.github.Issue;
    import com.pulumi.github.IssueArgs;
    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 an issue with milestone and project assignment
            var test = new Repository("test", RepositoryArgs.builder()
                .name("tf-acc-test-%s")
                .autoInit(true)
                .hasIssues(true)
                .build());
    
            var testRepositoryMilestone = new RepositoryMilestone("testRepositoryMilestone", RepositoryMilestoneArgs.builder()
                .owner(StdFunctions.split().applyValue(invoke -> invoke.result()[0]))
                .repository(test.name())
                .title("v1.0.0")
                .description("General Availability")
                .dueDate("2022-11-22")
                .state("open")
                .build());
    
            var testIssue = new Issue("testIssue", IssueArgs.builder()
                .repository(test.name())
                .title("My issue")
                .body("My issue body")
                .labels(            
                    "bug",
                    "documentation")
                .assignees("bob-github")
                .milestoneNumber(testRepositoryMilestone.number())
                .build());
    
        }
    }
    
    resources:
      # Create an issue with milestone and project assignment
      test:
        type: github:Repository
        properties:
          name: tf-acc-test-%s
          autoInit: true
          hasIssues: true
      testRepositoryMilestone:
        type: github:RepositoryMilestone
        name: test
        properties:
          owner:
            fn::invoke:
              Function: std:split
              Arguments:
                separator: /
                text: ${test.fullName}
              Return: result[0]
          repository: ${test.name}
          title: v1.0.0
          description: General Availability
          dueDate: 2022-11-22
          state: open
      testIssue:
        type: github:Issue
        name: test
        properties:
          repository: ${test.name}
          title: My issue
          body: My issue body
          labels:
            - bug
            - documentation
          assignees:
            - bob-github
          milestoneNumber: ${testRepositoryMilestone.number}
    

    Create Issue Resource

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

    Constructor syntax

    new Issue(name: string, args: IssueArgs, opts?: CustomResourceOptions);
    @overload
    def Issue(resource_name: str,
              args: IssueArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Issue(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              repository: Optional[str] = None,
              title: Optional[str] = None,
              assignees: Optional[Sequence[str]] = None,
              body: Optional[str] = None,
              labels: Optional[Sequence[str]] = None,
              milestone_number: Optional[int] = None)
    func NewIssue(ctx *Context, name string, args IssueArgs, opts ...ResourceOption) (*Issue, error)
    public Issue(string name, IssueArgs args, CustomResourceOptions? opts = null)
    public Issue(String name, IssueArgs args)
    public Issue(String name, IssueArgs args, CustomResourceOptions options)
    
    type: github:Issue
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args IssueArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args IssueArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args IssueArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IssueArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IssueArgs
    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 issueResource = new Github.Issue("issueResource", new()
    {
        Repository = "string",
        Title = "string",
        Assignees = new[]
        {
            "string",
        },
        Body = "string",
        Labels = new[]
        {
            "string",
        },
        MilestoneNumber = 0,
    });
    
    example, err := github.NewIssue(ctx, "issueResource", &github.IssueArgs{
    	Repository: pulumi.String("string"),
    	Title:      pulumi.String("string"),
    	Assignees: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Body: pulumi.String("string"),
    	Labels: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	MilestoneNumber: pulumi.Int(0),
    })
    
    var issueResource = new Issue("issueResource", IssueArgs.builder()
        .repository("string")
        .title("string")
        .assignees("string")
        .body("string")
        .labels("string")
        .milestoneNumber(0)
        .build());
    
    issue_resource = github.Issue("issueResource",
        repository="string",
        title="string",
        assignees=["string"],
        body="string",
        labels=["string"],
        milestone_number=0)
    
    const issueResource = new github.Issue("issueResource", {
        repository: "string",
        title: "string",
        assignees: ["string"],
        body: "string",
        labels: ["string"],
        milestoneNumber: 0,
    });
    
    type: github:Issue
    properties:
        assignees:
            - string
        body: string
        labels:
            - string
        milestoneNumber: 0
        repository: string
        title: string
    

    Issue Resource Properties

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

    Inputs

    The Issue resource accepts the following input properties:

    Repository string
    The GitHub repository name
    Title string
    Title of the issue
    Assignees List<string>
    List of Logins to assign the to the issue
    Body string
    Body of the issue
    Labels List<string>
    List of labels to attach to the issue
    MilestoneNumber int
    Milestone number to assign to the issue
    Repository string
    The GitHub repository name
    Title string
    Title of the issue
    Assignees []string
    List of Logins to assign the to the issue
    Body string
    Body of the issue
    Labels []string
    List of labels to attach to the issue
    MilestoneNumber int
    Milestone number to assign to the issue
    repository String
    The GitHub repository name
    title String
    Title of the issue
    assignees List<String>
    List of Logins to assign the to the issue
    body String
    Body of the issue
    labels List<String>
    List of labels to attach to the issue
    milestoneNumber Integer
    Milestone number to assign to the issue
    repository string
    The GitHub repository name
    title string
    Title of the issue
    assignees string[]
    List of Logins to assign the to the issue
    body string
    Body of the issue
    labels string[]
    List of labels to attach to the issue
    milestoneNumber number
    Milestone number to assign to the issue
    repository str
    The GitHub repository name
    title str
    Title of the issue
    assignees Sequence[str]
    List of Logins to assign the to the issue
    body str
    Body of the issue
    labels Sequence[str]
    List of labels to attach to the issue
    milestone_number int
    Milestone number to assign to the issue
    repository String
    The GitHub repository name
    title String
    Title of the issue
    assignees List<String>
    List of Logins to assign the to the issue
    body String
    Body of the issue
    labels List<String>
    List of labels to attach to the issue
    milestoneNumber Number
    Milestone number to assign to the issue

    Outputs

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

    Etag string
    Id string
    The provider-assigned unique ID for this managed resource.
    IssueId int
    (Computed) - The issue id
    Number int
    (Computed) - The issue number
    Etag string
    Id string
    The provider-assigned unique ID for this managed resource.
    IssueId int
    (Computed) - The issue id
    Number int
    (Computed) - The issue number
    etag String
    id String
    The provider-assigned unique ID for this managed resource.
    issueId Integer
    (Computed) - The issue id
    number Integer
    (Computed) - The issue number
    etag string
    id string
    The provider-assigned unique ID for this managed resource.
    issueId number
    (Computed) - The issue id
    number number
    (Computed) - The issue number
    etag str
    id str
    The provider-assigned unique ID for this managed resource.
    issue_id int
    (Computed) - The issue id
    number int
    (Computed) - The issue number
    etag String
    id String
    The provider-assigned unique ID for this managed resource.
    issueId Number
    (Computed) - The issue id
    number Number
    (Computed) - The issue number

    Look up Existing Issue Resource

    Get an existing Issue 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?: IssueState, opts?: CustomResourceOptions): Issue
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            assignees: Optional[Sequence[str]] = None,
            body: Optional[str] = None,
            etag: Optional[str] = None,
            issue_id: Optional[int] = None,
            labels: Optional[Sequence[str]] = None,
            milestone_number: Optional[int] = None,
            number: Optional[int] = None,
            repository: Optional[str] = None,
            title: Optional[str] = None) -> Issue
    func GetIssue(ctx *Context, name string, id IDInput, state *IssueState, opts ...ResourceOption) (*Issue, error)
    public static Issue Get(string name, Input<string> id, IssueState? state, CustomResourceOptions? opts = null)
    public static Issue get(String name, Output<String> id, IssueState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    Assignees List<string>
    List of Logins to assign the to the issue
    Body string
    Body of the issue
    Etag string
    IssueId int
    (Computed) - The issue id
    Labels List<string>
    List of labels to attach to the issue
    MilestoneNumber int
    Milestone number to assign to the issue
    Number int
    (Computed) - The issue number
    Repository string
    The GitHub repository name
    Title string
    Title of the issue
    Assignees []string
    List of Logins to assign the to the issue
    Body string
    Body of the issue
    Etag string
    IssueId int
    (Computed) - The issue id
    Labels []string
    List of labels to attach to the issue
    MilestoneNumber int
    Milestone number to assign to the issue
    Number int
    (Computed) - The issue number
    Repository string
    The GitHub repository name
    Title string
    Title of the issue
    assignees List<String>
    List of Logins to assign the to the issue
    body String
    Body of the issue
    etag String
    issueId Integer
    (Computed) - The issue id
    labels List<String>
    List of labels to attach to the issue
    milestoneNumber Integer
    Milestone number to assign to the issue
    number Integer
    (Computed) - The issue number
    repository String
    The GitHub repository name
    title String
    Title of the issue
    assignees string[]
    List of Logins to assign the to the issue
    body string
    Body of the issue
    etag string
    issueId number
    (Computed) - The issue id
    labels string[]
    List of labels to attach to the issue
    milestoneNumber number
    Milestone number to assign to the issue
    number number
    (Computed) - The issue number
    repository string
    The GitHub repository name
    title string
    Title of the issue
    assignees Sequence[str]
    List of Logins to assign the to the issue
    body str
    Body of the issue
    etag str
    issue_id int
    (Computed) - The issue id
    labels Sequence[str]
    List of labels to attach to the issue
    milestone_number int
    Milestone number to assign to the issue
    number int
    (Computed) - The issue number
    repository str
    The GitHub repository name
    title str
    Title of the issue
    assignees List<String>
    List of Logins to assign the to the issue
    body String
    Body of the issue
    etag String
    issueId Number
    (Computed) - The issue id
    labels List<String>
    List of labels to attach to the issue
    milestoneNumber Number
    Milestone number to assign to the issue
    number Number
    (Computed) - The issue number
    repository String
    The GitHub repository name
    title String
    Title of the issue

    Import

    GitHub Issues can be imported using an ID made up of repository:number, e.g.

    $ pulumi import github:index/issue:Issue issue_15 myrepo:15
    

    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.
    github logo
    GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi