Skip to content

gh issue create -R doesn't show issue templates #2361

Description

@camelid

Describe the bug

gh issue create -R doesn't ask to choose an issue template, while gh issue create in a clone of the repo does.

Steps to reproduce the behavior

  1. Type gh issue create -R rust-lang/rust (should happen for cli/cli too)
  2. It immediately asks for the title
  3. Now cd into a clone of rust-lang/rust and type gh issue create
  4. Note that it asks to choose a template

Expected vs actual behavior

Both should ask to choose a template.

Activity

  1. divyaramanathan commented on Nov 6, 2020

    @divyaramanathan
    Contributor

    Hello! I might be interested in taking a deeper look at this; does your team have any resources or tips you'd recommend to get started? Thanks so much!

  2. added
    enhancementa request to improve CLI
    and removed
    bugSomething isn't working
    on Nov 16, 2020
  3. samcoe commented on Nov 16, 2020

    @samcoe
    Contributor

    @camelid Good catch. I changed this to an enhancement since right now that is how the command is designed to work. We only check locally for issue templates, and when specifying the -R flag it is not required to have the repository cloned locally. The GraphQL API does expose repo issue templates though https://docs.github.com/en/free-pro-team@latest/graphql/reference/objects#issuetemplate so I don't see why we could not support handling this case.

  4. added
    coreThis issue is not accepting PRs from outside contributors
    and removed on Nov 16, 2020
  5. added
    bugSomething isn't working
    priority-2Affects more than a few users but doesn't prevent core functions
    and removed
    coreThis issue is not accepting PRs from outside contributors
    enhancementa request to improve CLI
    on Nov 16, 2020
  6. mislav commented on Nov 16, 2020

    @mislav
    Contributor

    @divyaramanathan Sorry for the late reply! We would appreciate if someone like you could take a stab at this.

    There is now a Repository.issueTemplates GraphQL connection that returns a list of IssueTemplate objects. Our original templates implementation predates this API, so we opted to read the templates from disk instead. This, of course, does not work with -R.

    My preferred solution would be to use the API both when -R was passed and when it wasn't passed. See pkg/cmd/issue/create/create.go for existing code that uses githubtemplate, but should use API calls instead. You can try prototyping up these API calls!

    For pull request templates, we still have to read files from disk (i.e. use the old approach) because there is no Repository.pullRequestTemplates GraphQL API.

    @samcoe I've reclassified this as a bug, even though the original code is working as intended, since I feel that issue/PR templates should behave the same regardless of whether -R was used.

  7. divyaramanathan commented on Dec 3, 2020

    @divyaramanathan
    Contributor

    Hey @mislav and @samcoe! Apologies for the late reply to this, but finally took a stab at it!

    Myself and @zaboyle wrote up a GraphQL API call to get issue templates and are attempting to use these when creating issues from the command line. Our changes are in #2539 and we'd love to hear any and all feedback!

    Follow-up question: We noticed that the program was still defaulting to read files from the file system. How would you recommend calling the API appropriately? Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContributions welcomepriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions