Skip to content

gh project item-list Should Include Draft Issue ID #8005

@dsanders11

Description

@dsanders11

Describe the feature or problem you’d like to solve

To use gh project item-edit on a draft issue to edit the title or body, you need the draft issue content ID, but the output of gh project item-list does not include that ID, so it's difficult to edit draft issues from the CLI.

Proposed solution

There should be an id field under content when outputting JSON for gh project item-list so that users can get the ID they need to edit the draft issue.

Alternatively gh project item-edit could be updated to do an additional query to try to convert an ID with prefix PVTI_ to DI_ and failing if it's not a draft issue.

Additional context

Relevant code section about requiring the draft issue ID to edit title or body:

// update draft issue
if config.opts.title != "" || config.opts.body != "" {
if !strings.HasPrefix(config.opts.itemID, "DI_") {
return cmdutil.FlagErrorf("ID must be the ID of the draft issue content which is prefixed with `DI_`")
}
query, variables := buildEditDraftIssue(config)
err := config.client.Mutate("EditDraftIssueItem", query, variables)
if err != nil {
return err
}
if config.opts.format == "json" {
return printDraftIssueJSON(config, query.UpdateProjectV2DraftIssue.DraftIssue)
}
return printDraftIssueResults(config, query.UpdateProjectV2DraftIssue.DraftIssue)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-projectrelating to the gh project commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions