1. Packages
  2. GitHub
  3. API Docs
  4. Issue
GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi

github.Issue

Explore with Pulumi AI

github logo
GitHub v6.1.0 published on Monday, Mar 11, 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 testRepository = new github.Repository("testRepository", {
        autoInit: true,
        hasIssues: true,
    });
    const testIssue = new github.Issue("testIssue", {
        repository: testRepository.name,
        title: "My issue title",
        body: "The body of my issue",
    });
    
    import pulumi
    import pulumi_github as github
    
    # Create a simple issue
    test_repository = github.Repository("testRepository",
        auto_init=True,
        has_issues=True)
    test_issue = github.Issue("testIssue",
        repository=test_repository.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
    		testRepository, err := github.NewRepository(ctx, "testRepository", &github.RepositoryArgs{
    			AutoInit:  pulumi.Bool(true),
    			HasIssues: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewIssue(ctx, "testIssue", &github.IssueArgs{
    			Repository: testRepository.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 testRepository = new Github.Repository("testRepository", new()
        {
            AutoInit = true,
            HasIssues = true,
        });
    
        var testIssue = new Github.Issue("testIssue", new()
        {
            Repository = testRepository.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) {
            var testRepository = new Repository("testRepository", RepositoryArgs.builder()        
                .autoInit(true)
                .hasIssues(true)
                .build());
    
            var testIssue = new Issue("testIssue", IssueArgs.builder()        
                .repository(testRepository.name())
                .title("My issue title")
                .body("The body of my issue")
                .build());
    
        }
    }
    
    resources:
      # Create a simple issue
      testRepository:
        type: github:Repository
        properties:
          autoInit: true
          hasIssues: true
      testIssue:
        type: github:Issue
        properties:
          repository: ${testRepository.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";
    
    // Create an issue with milestone and project assignment
    const testRepository = new github.Repository("testRepository", {
        autoInit: true,
        hasIssues: true,
    });
    const testRepositoryMilestone = new github.RepositoryMilestone("testRepositoryMilestone", {
        owner: testRepository.fullName.apply(fullName => fullName.split("/")).apply(split => split[0]),
        repository: testRepository.name,
        title: "v1.0.0",
        description: "General Availability",
        dueDate: "2022-11-22",
        state: "open",
    });
    const testIssue = new github.Issue("testIssue", {
        repository: testRepository.name,
        title: "My issue",
        body: "My issue body",
        labels: [
            "bug",
            "documentation",
        ],
        assignees: ["bob-github"],
        milestoneNumber: testRepositoryMilestone.number,
    });
    
    import pulumi
    import pulumi_github as github
    
    # Create an issue with milestone and project assignment
    test_repository = github.Repository("testRepository",
        auto_init=True,
        has_issues=True)
    test_repository_milestone = github.RepositoryMilestone("testRepositoryMilestone",
        owner=test_repository.full_name.apply(lambda full_name: full_name.split("/")).apply(lambda split: split[0]),
        repository=test_repository.name,
        title="v1.0.0",
        description="General Availability",
        due_date="2022-11-22",
        state="open")
    test_issue = github.Issue("testIssue",
        repository=test_repository.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/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create an issue with milestone and project assignment
    		testRepository, err := github.NewRepository(ctx, "testRepository", &github.RepositoryArgs{
    			AutoInit:  pulumi.Bool(true),
    			HasIssues: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		testRepositoryMilestone, err := github.NewRepositoryMilestone(ctx, "testRepositoryMilestone", &github.RepositoryMilestoneArgs{
    			Owner: testRepository.FullName.ApplyT(func(fullName string) (pulumi.StringArray, error) {
    				return pulumi.StringArray("TODO: call split"), nil
    			}).(pulumi.StringArrayOutput).ApplyT(func(split []string) (string, error) {
    				return split[0], nil
    			}).(pulumi.StringOutput),
    			Repository:  testRepository.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, "testIssue", &github.IssueArgs{
    			Repository: testRepository.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;
    
    return await Deployment.RunAsync(() => 
    {
        // Create an issue with milestone and project assignment
        var testRepository = new Github.Repository("testRepository", new()
        {
            AutoInit = true,
            HasIssues = true,
        });
    
        var testRepositoryMilestone = new Github.RepositoryMilestone("testRepositoryMilestone", new()
        {
            Owner = testRepository.FullName.Apply(fullName => fullName.Split("/")).Apply(split => split[0]),
            Repository = testRepository.Name,
            Title = "v1.0.0",
            Description = "General Availability",
            DueDate = "2022-11-22",
            State = "open",
        });
    
        var testIssue = new Github.Issue("testIssue", new()
        {
            Repository = testRepository.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) {
            var testRepository = new Repository("testRepository", RepositoryArgs.builder()        
                .autoInit(true)
                .hasIssues(true)
                .build());
    
            var testRepositoryMilestone = new RepositoryMilestone("testRepositoryMilestone", RepositoryMilestoneArgs.builder()        
                .owner(testRepository.fullName().applyValue(fullName -> fullName.split("/")).applyValue(split -> split[0]))
                .repository(testRepository.name())
                .title("v1.0.0")
                .description("General Availability")
                .dueDate("2022-11-22")
                .state("open")
                .build());
    
            var testIssue = new Issue("testIssue", IssueArgs.builder()        
                .repository(testRepository.name())
                .title("My issue")
                .body("My issue body")
                .labels(            
                    "bug",
                    "documentation")
                .assignees("bob-github")
                .milestoneNumber(testRepositoryMilestone.number())
                .build());
    
        }
    }
    
    Coming soon!
    

    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.

    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.1.0 published on Monday, Mar 11, 2024 by Pulumi