Use issue list API instead of search #78
No reviewers
Labels
No Label
breaking
bug
build
duplicate
enhancement
feature
help wanted
invalid
lgtm
done
lgtm
need 1
question
skip-changelog
wontfix
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/changelog#78
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "jolheiser/changelog:issue-search"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR changes to using the GH issue list API rather than search, as for some reason the search results started missing several PRs...
@ -27,0 +31,4 @@
func (gh *GitHub) OwnerRepo() (string, string) {
parts := strings.Split(gh.Repo, "/")
if len(parts) < 2 {
return parts[0], ""
Realistically this could probably even error or something, but I'm fairly sure it would cause issues elsewhere anyways, so I left it simple.
@ -126,0 +148,4 @@
milestones, _, err := client.Issues.ListMilestones(ctx, owner, repo, &github.MilestoneListOptions{
State: "all",
ListOptions: github.ListOptions{
PerPage: 100,
Please have a look at my diff that fixes the problem in the most common cases (basically always):
Applied with modifications to loop (unlikely, but may as well for completeness)
41f3e3b8f0
to5b87d1331c
@ -46,1 +58,3 @@
result, _, err := gh.client.Search.Issues(ctx, query, &github.SearchOptions{
result, _, err := gh.client.Issues.ListByRepo(ctx, owner, repo, &github.IssueListByRepoOptions{
Milestone: strconv.Itoa(milestoneNum),
State: "closed",
What about PRs that were closed, not merged, and still assigned to the milestone?
Aren't they false-positives?
@ -96,1 +114,3 @@
result, _, err := gh.client.Search.Issues(ctx, query, &github.SearchOptions{
result, _, err := gh.client.Issues.ListByRepo(ctx, owner, repo, &github.IssueListByRepoOptions{
Milestone: strconv.Itoa(milestoneNum),
State: "closed",
See above
@delvh Good catch, however unfortunately there's no good way to do this.
If I use the PR List endpoint, there's no way to specify a milestone.
The only other option is to use the merge status endpoint for every PR in the list, which might work but is going to be expensive to query for each item.
I wonder if it's finally time to use the graphql api for this... 🤢
Approving despite the bug at the moment.