-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Describe the bug
gh version 2.22.1 (2023-01-27)
Projects Classic are tied to a repository, while Projects V2 may be linked to a repository, but are independent of them.
In addition, Projects V2 titles do not need to be unique.
This resulted in two surprising behaviors when using gh pr edit URL --add-project with a project V2 (I haven't tested this with gh issues edit).
If I have a ProjectV2 which isn't linked a repository, the edit command fails:
$ gh pr edit https://github.com/mntlty/REPO/pull/1 --add-project "@mntlty's untitled project"
'@mntlty's untitled project' not found
After linking the project the PR's repo in the UI:
$ gh pr edit https://github.com/mntlty/REPO/pull/1 --add-project "@mntlty's untitled project"
https://github.com/mntlty/REPO/pull/1
I assume this is related to the lookup for project name to title is part of RepoMetaDataResult
Line 748 in 1786ece
| func (m *RepoMetadataResult) projectV2TitleToID(projectTitle string) (string, bool) { |
I also tested linking two projects with the same name @mntlty's untitled project to my test repo, the PR is only added to one of the projects, not both. There is no such restriction in the UI - the same PR can be added to multiple projects which have the same name.
Multiple project with the same name is potentially quite common and may be confusing - newly created Projects V2 via the UI are given the same name, for example @mntlty's untitled project, and in larger orgs with many projects name collisions are likely.
Steps to reproduce the behavior
Steps above 😄
Expected vs actual behavior
- Project lookup by name should succeed even if the ProjectV2 isn't linked to the repository
- Adding a PR to a ProjectsV2 should either add it to all the projects with that name, or the behavior be called out in the help command
Logs
N/A