-
Notifications
You must be signed in to change notification settings - Fork 7.3k
fix gh pr edit: do not fetch V1 projects on unsupported GitHub hosts
#11987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Update FetchOptions and related function signatures to accept a ProjectsV1Support parameter, enabling conditional logic based on project support. This change improves flexibility for handling project fields in issue and PR editing flows.
Added Detector field with EnabledDetectorMock to EditOptions in issue and PR edit command tests to ensure feature detection logic is exercised during test runs. Also updated EditableOptionsFetch signature in pr/edit/edit_test.go to include projectsV1Support parameter for compatibility with shared.FetchOptions.
| ProjectsV1: editable.Projects.Edited, | ||
| ProjectsV1: editable.Projects.Edited && projectV1Support == gh.ProjectsV1Supported, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual meat and potatoes. The rest of the changes are just to satisfy the interface change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes an issue where project v1 data was being fetched on GitHub hosts that don't support project v1. The change adds explicit project v1 support checking by passing gh.ProjectsV1Support through the editing workflow, ensuring project v1 options are only fetched when supported by the repository.
- Updated function signatures to accept
gh.ProjectsV1Supportparameter - Modified
FetchOptionsto conditionally fetch project v1 data based on support status - Added detector mock to test cases to support the new parameter
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cmd/pr/shared/editable.go | Updated FetchOptions signature to accept project v1 support parameter and conditionally fetch v1 projects |
| pkg/cmd/pr/edit/edit.go | Updated interface and implementation to pass project v1 support status when fetching options |
| pkg/cmd/pr/edit/edit_test.go | Updated test fetcher to match new function signature |
| pkg/cmd/issue/edit/edit.go | Updated function signature to accept project v1 support parameter and pass it when fetching options |
| pkg/cmd/issue/edit/edit_test.go | Added detector mocks to test options to support new parameter requirement |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Can we also have a test to verify the Projects V1 data are not fetched?
Introduces a test case to ensure that when editing pull requests non-interactively and projects v1 is unsupported, v1 project metadata is not fetched and only v2 project queries are made.
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | patch | `v2.82.0` -> `v2.82.1` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.82.1`](https://github.com/cli/cli/releases/tag/v2.82.1): GitHub CLI 2.82.1 [Compare Source](cli/cli@v2.82.0...v2.82.1) #### Fix `gh pr edit` not detecting classic projects feature deprecation `gh pr edit` was not correctly detecting the classic projects API deprecation. This release fixes that detection and avoids an incorrect fetch to the deprecated APIs. This only impacted `gh pr edit` commands used to add or remove projects. #### What's Changed ##### 🐛 Fixes - fix `gh pr edit`: do not fetch V1 projects on unsupported GitHub hosts by [@​BagToad](https://github.com/BagToad) in [#​11987](cli/cli#11987) #####Dependencies - chore(deps): bump github/codeql-action from 3 to 4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​11881](cli/cli#11881) - chore(deps): Bump github.com/sigstore/sigstore-go from 1.1.0 to 1.1.3 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​11830](cli/cli#11830) - chore(deps): bump github.com/gabriel-vasile/mimetype from 1.4.9 to 1.4.10 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​11659](cli/cli#11659) - chore(deps): bump actions/attest-build-provenance from 2.4.0 to 3.0.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​11612](cli/cli#11612) **Full Changelog**: <cli/cli@v2.82.0...v2.82.1> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNTIuOSIsInVwZGF0ZWRJblZlciI6IjQxLjE1Mi45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
This pull request updates how project v1 support is handled when editing issues and pull requests. The main change is to pass explicit project v1 support information through the editing workflow, ensuring that project v1 options are only fetched and presented when supported by the repository. This affects function signatures, calls, and related tests for both issues and pull requests.
Fixes #11986