-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
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.
cli/internal/featuredetection/feature_detection.go
Lines 208 to 216 in 7d70980
| 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
projectCardsbut return empty results for backwards compatibility with olderghreleases
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"
}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 implemented- Feature detect v1 projects on
issue view#10813 - Feature detect v1 projects on non web-mode
issue create#10815 - Feature detect v1 projects on web mode issue create #10818
- Feature detect v1 projects on issue edit #10819
- Feature detect v1 projects on pr view #10821
- Feature detect v1 projects on non-interactive pr create #10909
- Feature detect v1 projects on web mode pr create #10911
- Feature detect v1 projects on interactive
pr create#10915 - Feature detect v1 projects on pr edit #10942
- Feature detect v1 projects on
Acceptance Criteria
-
Given I am targeting GHES 3.16.x repository with v1 and v2 projects
When I interactively executegh issue createcommand 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 executegh issue view NUMBER_OR_URL --json projectCards,projectItemscommand
Thenghwill 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 executegh issue view NUMBER_OR_URL --json projectCards,projectItemscommand
Thenghwill 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 executegh issue createcommand 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 executegh issue view NUMBER_OR_URL --json projectCards,projectItemscommand
Thenghwill 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 executegh issue view NUMBER_OR_URLcommand
Thenghwill 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
