You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting "template not found" errors for gh issue create --template=... #9327
Running gh issue create ignores my templates in .github/, fi. .github/ISSUE_TEMPLATE.md. gh issue create -T .github/ISSUE_TEMPLATE.md or with --tempalate yields "no template found"
$ gh --version
gh version 2.52.0 (2024-06-24)
https://github.com/cli/cli/releases/tag/v2.52.0
Steps to reproduce the behavior
Place issue template generated via GitHub in ./github/ISSUE_TEMPLATE.md
2a. gh issue create
3a. No template used for issue creation
$ gh issue create -T .github/ISSUE_TEMPLATE.md
Creating issue in PhilippFeO/nvim
? Title Test
X operation failed. To restore: gh issue create --recover /tmp/gh2397437919.json
no templates found
$ gh issue create -T ISSUE_TEMPLATE.md
Creating issue in PhilippFeO/nvim
? Title TEST
X operation failed. To restore: gh issue create --recover /tmp/gh2679218676.json
no templates found
$ ls .github
ISSUE_TEMPLATE.md vorlage_1.md
Expected vs actual behavior
I expected that my template is used in some way or the other.
Issue templates are stored on the repository's default branch, in a hidden .github/ISSUE_TEMPLATE directory. If you create a template in another branch, it will not be available for collaborators to use.
You must create templates on the repository's default branch. Templates created in other branches are not available for collaborators to use.
Not to worry though, definitely an easy mistake to make. I don't think there's anything we can do to help you here unfortunately. I suppose we could say something like "no templates found, are you sure they are on the default branch?".
Embarrassing, I didn't catch both sentences! 🙈 I am sorry!
Sad, that it just doesn't work on my machine :/ Out of curiosity: Do you have any assumptions which might be too technical for a discussion via GitHub? You can't debug everything here.
We could consider having gh look at your currently open repo in some cases. For example, if the template was used to populate your local editor we could probably do that, but it wouldn't work with --template --web obviously, which might be confusing. I don't know whether we would accept this as a feature or not but I'd be open to the discussion.
Out of curiosity: Do you have any assumptions which might be too technical for a discussion via GitHub? You can't debug everything here.
I dont plan using --web on any occasion because I control gh via a Neovim plugin – but other people might.
We could consider having gh look at your currently open repo in some cases. For example, if the template was used to populate your local editor we could probably do that [...]
Isn't it too late then? Sounds like a pot look up to me (maybe don't getting your point).
When I write software and it doesn't work for a user, it is unsatisfying to not be able to help him but it is even more unsatisfying not to know why it doesn't work. Since you can debug more efficiently face to face with the machine, you have more capabilities to find the bug – means are limited on GitHub. So, I wonder if you have something in mind you would do/check in case my machine would be under your control. It is a quite theoretical definition.
Isn't it too late then? Sounds like a pot look up to me (maybe don't getting your point).
➜ gh issue create
Creating issue in cli/cli
? Title Template Demo
? Choose a template [Use arrows to move, type to filter]
> 🐛 Bug report
📣 Feedback
⭐ Submit a request
Open a blank issue
At this point, the template is loaded into your editor.
These templates are pulled from the API, as you've seen above. My suggestion is that maybe they could also look at files in your local git repo, if you are in one. I don't think it's a great idea because I think it's probably a lot more confusing than what currently exists (for example, what if you have a modified local template, should we use that one, or the remote one).
So, I wonder if you have something in mind you would do/check in case my machine would be under your control. It is a quite theoretical definition.
Gotcha. In this particular case I didn't need to do much because your repo was public so I could run the same command you did with GH_DEBUG=api, see that the IssueTemplates node was empty, and then check your repo to confirm.
But other times of course there are challenges, the most challenging of which are around different platforms and configurations, particularly when they are unusual.
These templates are pulled from the API, as you've seen above. My suggestion is that maybe they could also look at files in your local git repo, if you are in one. I don't think it's a great idea because I think it's probably a lot more confusing than what currently exists (for example, what if you have a modified local template, should we use that one, or the remote one).
I hadn't this in mind. I thought gh looks at my local folder. But it makes sense to pull them because the templates have to work on github.com as well. Good to know, thank you!
Isn't it possible to do it like this:
Pull from API
No results (as seen by my repo): look at the local .github folder
In my case, having local issue templates is more than sufficient but I guess gh also aims to larger Open Source projects which have to use defined templates to keep track. Users with their own templates create confusion – then it doesn't make sense.
Then, the questions shifts to "How do we control the procedure?" because 2. has to be optional. (Personally, I am a friend of config files.)
It's possible but there are some weird behaviours that can crop up. For example, let's say you are working on a repository that has no templates, then one of your collaborators adds one, now your local set up is broken in a surprising way that you have no visibility into.
I think that if you want to have a template locally, that's probably a distinct thing from GitHub Templates and you should use gh issue create --body-file <path to file> --editor which will prefill your editor with the contents of that file. This was just released yesterday, so you'll need to upgrade. Try it out and let me know if it works the way you expect.
Activity
williammartin commentedon Jul 18, 2024
Well your terminal output is part of it, and running the commands with
GH_DEBUG=apiis another.When I run with
GH_DEBUG=apiI can see that your repository returned no templates:When I look at your repository I don't see a
.githubfolder: https://github.com/PhilippFeO/nvimIs it possible that the issue template is only in your local git repository? I could understand how that might be confusing.
PhilippFeO commentedon Jul 18, 2024
I have a branch for testing the feature: https://github.com/PhilippFeO/nvim/tree/octo-test
But am I write in assuming that this feature only works if the folder and files were commited?
Can I share the output of
gh issue createwithGH_DEBUG=apiwithout exposing any secrets? The logs are quite long and I am no web dev expert 😅williammartin commentedon Jul 18, 2024
There are no secrets in there but for example, you may have confidential information like company repositories. Doesn't look like it in your case.
Ah yes, unfortunately issue templates are based on the default branch, in your case
main.PhilippFeO commentedon Jul 18, 2024
Haven't seen this piece in the docs 😅 But it doesn't make a difference. I moved
.githubintomain, commited, pushed but still 'no template found'. :(Logs, ie
GH_DEBUG=api:williammartin commentedon Jul 18, 2024
https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/about-issue-and-pull-request-templates
Not to worry though, definitely an easy mistake to make. I don't think there's anything we can do to help you here unfortunately. I suppose we could say something like "no templates found, are you sure they are on the default branch?".
PhilippFeO commentedon Jul 18, 2024
Embarrassing, I didn't catch both sentences! 🙈 I am sorry!
Sad, that it just doesn't work on my machine :/ Out of curiosity: Do you have any assumptions which might be too technical for a discussion via GitHub? You can't debug everything here.
williammartin commentedon Jul 18, 2024
We could consider having
ghlook at your currently open repo in some cases. For example, if the template was used to populate your local editor we could probably do that, but it wouldn't work with--template --webobviously, which might be confusing. I don't know whether we would accept this as a feature or not but I'd be open to the discussion.I'm sorry, I don't understand the question!
PhilippFeO commentedon Jul 18, 2024
I dont plan using
--webon any occasion because I controlghvia a Neovim plugin – but other people might.Isn't it too late then? Sounds like a pot look up to me (maybe don't getting your point).
When I write software and it doesn't work for a user, it is unsatisfying to not be able to help him but it is even more unsatisfying not to know why it doesn't work. Since you can debug more efficiently face to face with the machine, you have more capabilities to find the bug – means are limited on GitHub. So, I wonder if you have something in mind you would do/check in case my machine would be under your control. It is a quite theoretical definition.
williammartin commentedon Jul 18, 2024
At this point, the template is loaded into your editor.
These templates are pulled from the API, as you've seen above. My suggestion is that maybe they could also look at files in your local git repo, if you are in one. I don't think it's a great idea because I think it's probably a lot more confusing than what currently exists (for example, what if you have a modified local template, should we use that one, or the remote one).
Gotcha. In this particular case I didn't need to do much because your repo was public so I could run the same command you did with
GH_DEBUG=api, see that theIssueTemplatesnode was empty, and then check your repo to confirm.But other times of course there are challenges, the most challenging of which are around different platforms and configurations, particularly when they are unusual.
PhilippFeO commentedon Jul 18, 2024
I hadn't this in mind. I thought
ghlooks at my local folder. But it makes sense to pull them because the templates have to work ongithub.comas well. Good to know, thank you!Isn't it possible to do it like this:
.githubfolderIn my case, having local issue templates is more than sufficient but I guess
ghalso aims to larger Open Source projects which have to use defined templates to keep track. Users with their own templates create confusion – then it doesn't make sense.Then, the questions shifts to "How do we control the procedure?" because 2. has to be optional. (Personally, I am a friend of config files.)
williammartin commentedon Jul 18, 2024
It's possible but there are some weird behaviours that can crop up. For example, let's say you are working on a repository that has no templates, then one of your collaborators adds one, now your local set up is broken in a surprising way that you have no visibility into.
I think that if you want to have a template locally, that's probably a distinct thing from GitHub Templates and you should use
gh issue create --body-file <path to file> --editorwhich will prefill your editor with the contents of that file. This was just released yesterday, so you'll need to upgrade. Try it out and let me know if it works the way you expect.PhilippFeO commentedon Jul 18, 2024
I'll let you know it tomorrow! :)
PhilippFeO commentedon Jul 19, 2024
It works! Thank you! 🚀
williammartin commentedon Jul 19, 2024
Great, thanks! I'm gonna close this now.