-
Notifications
You must be signed in to change notification settings - Fork 7.8k
gh pr edit: Ensure empty arrays for reviewers in PR API calls
#12122
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
Updated AddPullRequestReviews and RemovePullRequestReviews to send empty arrays instead of null values for reviewers and team_reviewers when no users or teams are specified, as required by the API.
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 PR attempts to fix an issue where the GitHub API requires empty arrays instead of null values for the reviewers and team_reviewers fields when adding or removing pull request reviewers. The changes remove the omitempty JSON tags and add logic to initialize nil slices to empty arrays.
Key Changes:
- Removed
omitemptyfrom JSON struct tags forReviewersandTeamReviewersfields - Added empty array initialization logic for nil
usersandteamsslices - Applied changes to both
AddPullRequestReviewsandRemovePullRequestReviewsfunctions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
babakks
left a comment
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! Just a nitpick comment.
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | patch | `v2.83.0` -> `v2.83.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.83.1`](https://github.com/cli/cli/releases/tag/v2.83.1): GitHub CLI 2.83.1 [Compare Source](cli/cli@v2.83.0...v2.83.1) #### What's Changed ##### 🐛 Fixes - `gh pr edit`: Ensure empty arrays for reviewers in MR API calls by [@​BagToad](https://github.com/BagToad) in [#​12122](cli/cli#12122) ##### 📚 Docs & Chores - Integrate license checks back into lint workflow by [@​BagToad](https://github.com/BagToad) in [#​12112](cli/cli#12112) - Update third-party licenses and dependencies by [@​BagToad](https://github.com/BagToad) in [#​12123](cli/cli#12123) #####Dependencies - chore(deps): bump golangci/golangci-lint-action from 8.0.0 to 9.0.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12134](cli/cli#12134) **Full Changelog**: <cli/cli@v2.83.0...v2.83.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:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNzMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE3My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Updated AddPullRequestReviews and RemovePullRequestReviews to send empty arrays instead of null values for reviewers and team_reviewers when no users or teams are specified, as required by the API.
Fixes #12120