Description
Currently, gh determines whether v1 classic projects are supported based on the type of host (GitHub.com, ghe.com, GHES). This logic needs to be enhanced as v1 classic projects were deprecated in GHES 3.17 (ETA June 3rd), so only GHES 3.16 or older can continue using it.
|
func (d *detector) ProjectsV1() gh.ProjectsV1Support { |
|
// Currently, projects v1 support is entirely dependent on the host. As this is deprecated in GHES, |
|
// we will do feature detection on whether the GHES version has support. |
|
if ghauth.IsEnterprise(d.host) { |
|
return gh.ProjectsV1Supported |
|
} |
|
|
|
return gh.ProjectsV1Unsupported |
|
} |
Normally, gh would use GraphQL introspection for feature detection, using the presence of projectCards field. Unfortunately, there are inconsistencies around projectCards in GraphQL schema that make this complicated:
- GHES 3.17.0 will drop
projectCards
- GitHub.com and ghe.com will show
projectCards but return empty results for backwards compatibility with older gh releases
Instead, the v1 classic project feature detection should be enhanced to use GHES version from /api/v3/meta REST endpoint to determine support:
{
"verifiable_password_authentication": false,
"installed_version": "3.17.0"
}
Expected outcomes
detector.ProjectsV1() will only report that v1 classic projects are supported for GHES 3.16.x and older
gh commands that perform v1 classic projects feature detection will continue to work as implemented
Acceptance Criteria
-
Given I am targeting GHES 3.16.x repository with v1 and v2 projects
When I interactively execute gh issue create command and add metadata
Then v1 and v2 projects are listed for selection
$ gh issue create --repo andyfeller-0ee0571e6658472ea.qaboot.net/ghe-admin/v1-repo-projects
Creating issue in ghe-admin/v1-repo-projects
? Title (required) Just an issue title
? Body <Received>
? What's next? Add metadata
? What would you like to add? Projects
Working...
? Projects [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
> [ ] v1 UI created project
[ ] v1 project
[ ] v1 project
[ ] v2 team planning
-
Given I am targeting GHES 3.16.x repository issue that is on a v1 and v2 project
When I execute gh issue view NUMBER_OR_URL --json projectCards,projectItems command
Then gh will export v1 and v2 projects as projectCards and projectItems respectively
$ bin/gh issue view https://andyfeller-0ee0571e6658472ea.qaboot.net/ghe-admin/v1-repo-projects/issues/4 --json projectCards,projectItems
Working...
{
"projectCards": [
{
"project": {
"name": "v1 UI created project"
},
"column": {
"name": ""
}
},
{
"project": {
"name": "v1 project"
},
"column": {
"name": ""
}
}
],
"projectItems": [
{
"status": {
"optionId": "",
"name": ""
},
"title": "v2 team planning"
}
]
}
-
Given I am targeting GHES 3.17.0 repository issue that is on a v2 project
When I execute gh issue view NUMBER_OR_URL --json projectCards,projectItems command
Then gh will export v2 projects as projectItems while projectCards is empty
$ gh issue view https://ghe.io/andyfeller/v1-repo-projects/issues/1 --json projectCards,projectItems
Working...
{
"projectCards": [],
"projectItems": [
{
"status": {
"optionId": "",
"name": ""
},
"title": "v2 team planning"
}
]
}
-
Given I am targeting GitHub.com repository issue that is on a v2 project
When I interactively execute gh issue create command and add metadata
Then v2 projects are listed for selection
$ gh issue create --repo cli/cli
Creating issue in cli/cli
? Title (required) Just a title
? Choose a template Open a blank issue
? Body <Received>
? What's next? Add metadata
? What would you like to add? Projects
Working...
? Projects [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
> [ ] Enhancement Triage
[ ] Help Wanted Backlog
[ ] Roadmap
[ ] andyfeller.github.io
[ ] All Issues & PRs
-
Given I am targeting GitHub.com repository issue that is on a v2 project
When I execute gh issue view NUMBER_OR_URL --json projectCards,projectItems command
Then gh will export v2 projects as projectItems while projectCards is empty
$ gh issue view https://github.com/cli/cli/issues/10704 --json projectCards,projectItems
Working...
{
"projectCards": [],
"projectItems": [
{
"status": {
"optionId": "046342ef",
"name": "Inbox"
},
"title": "All Issues & PRs"
}
]
}
-
Given I am targeting ghe.com repository issue that is on a v2 project
When I interactively execute gh issue view NUMBER_OR_URL command
Then gh will export v2 projects as projectItems while projectCards is empty
$ gh issue view https://github.ghe.com/andyfeller/gh-p/issues/1 --json projectCards,projectItems
Working...
{
"projectCards": [],
"projectItems": [
{
"status": {
"optionId": "",
"name": ""
},
"title": "v2 team planning"
}
]
}
Example of GHES 3.16.6 repository with v1 and v2 projects

Description
Currently,
ghdetermines whether v1 classic projects are supported based on the type of host (GitHub.com, ghe.com, GHES). This logic needs to be enhanced as v1 classic projects were deprecated in GHES 3.17 (ETA June 3rd), so only GHES 3.16 or older can continue using it.cli/internal/featuredetection/feature_detection.go
Lines 208 to 216 in 7d70980
Normally,
ghwould use GraphQL introspection for feature detection, using the presence ofprojectCardsfield. Unfortunately, there are inconsistencies aroundprojectCardsin GraphQL schema that make this complicated:projectCardsprojectCardsbut return empty results for backwards compatibility with olderghreleasesInstead, the v1 classic project feature detection should be enhanced to use GHES version from
/api/v3/metaREST endpoint to determine support:{ "verifiable_password_authentication": false, "installed_version": "3.17.0" }Note
There has been some spike efforts using the work in trunk...andyfeller/github-cli-867-ghes-meta-version-featuredetection to explore this issue that may be reused.
Expected outcomes
detector.ProjectsV1()will only report that v1 classic projects are supported for GHES 3.16.x and olderghcommands that perform v1 classic projects feature detection will continue to work as implementedissue view#10813issue create#10815pr create#10915Acceptance Criteria
Given I am targeting GHES 3.16.x repository with v1 and v2 projects
When I interactively execute
gh issue createcommand and add metadataThen v1 and v2 projects are listed for selection
Given I am targeting GHES 3.16.x repository issue that is on a v1 and v2 project
When I execute
gh issue view NUMBER_OR_URL --json projectCards,projectItemscommandThen
ghwill export v1 and v2 projects asprojectCardsandprojectItemsrespectively$ bin/gh issue view https://andyfeller-0ee0571e6658472ea.qaboot.net/ghe-admin/v1-repo-projects/issues/4 --json projectCards,projectItems Working... { "projectCards": [ { "project": { "name": "v1 UI created project" }, "column": { "name": "" } }, { "project": { "name": "v1 project" }, "column": { "name": "" } } ], "projectItems": [ { "status": { "optionId": "", "name": "" }, "title": "v2 team planning" } ] }Given I am targeting GHES 3.17.0 repository issue that is on a v2 project
When I execute
gh issue view NUMBER_OR_URL --json projectCards,projectItemscommandThen
ghwill export v2 projects asprojectItemswhileprojectCardsis empty$ gh issue view https://ghe.io/andyfeller/v1-repo-projects/issues/1 --json projectCards,projectItems Working... { "projectCards": [], "projectItems": [ { "status": { "optionId": "", "name": "" }, "title": "v2 team planning" } ] }Given I am targeting GitHub.com repository issue that is on a v2 project
When I interactively execute
gh issue createcommand and add metadataThen v2 projects are listed for selection
Given I am targeting GitHub.com repository issue that is on a v2 project
When I execute
gh issue view NUMBER_OR_URL --json projectCards,projectItemscommandThen
ghwill export v2 projects asprojectItemswhileprojectCardsis empty$ gh issue view https://github.com/cli/cli/issues/10704 --json projectCards,projectItems Working... { "projectCards": [], "projectItems": [ { "status": { "optionId": "046342ef", "name": "Inbox" }, "title": "All Issues & PRs" } ] }Given I am targeting ghe.com repository issue that is on a v2 project
When I interactively execute
gh issue view NUMBER_OR_URLcommandThen
ghwill export v2 projects asprojectItemswhileprojectCardsis empty$ gh issue view https://github.ghe.com/andyfeller/gh-p/issues/1 --json projectCards,projectItems Working... { "projectCards": [], "projectItems": [ { "status": { "optionId": "", "name": "" }, "title": "v2 team planning" } ] }Example of GHES 3.16.6 repository with v1 and v2 projects