FrankChen021 commented on code in PR #20694:
URL: https://github.com/apache/druid/pull/20694#discussion_r4359554933
##########
.github/scripts/auto-add-milestone.sh:
##########
@@ -19,13 +19,18 @@ set -e
get_milestone_number() {
local milestone_title="$1"
- local number=$(gh api "repos/$REPOSITORY/milestones" --jq ".[] |
select(.title==\"$milestone_title\") | .number")
+ local number=$(gh api "repos/$REPOSITORY/milestones?state=all&per_page=100"
--paginate --jq ".[] | select(.title==\"$milestone_title\") | .number")
Review Comment:
[P2] Paginated lookup masks API failures
**Finding:** Because `number` is initialized with a `local` declaration,
Bash returns the status of `local` rather than the command substitution. If `gh
api --paginate` fails while the matching milestone is on a later page, `set -e`
does not stop and `number` is empty, so the function calls the create endpoint
as if no milestone existed. This can create a duplicate milestone or assign the
PR to the wrong milestone.
**Suggestion:** Declare `number` separately and explicitly check the
paginated lookup status before treating an empty result as a missing milestone.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]