File tree Expand file tree Collapse file tree 4 files changed +48
-8
lines changed Expand file tree Collapse file tree 4 files changed +48
-8
lines changed Original file line number Diff line number Diff line change 4
4
5
5
## [ Unreleased]
6
6
7
+ * Fix: allow for issues with multiple labels & fix presubmission ingest (@lwasser )
8
+
7
9
## [ v0.3.2] - 2024-07-04
8
10
9
11
### Fixes
Original file line number Diff line number Diff line change @@ -73,12 +73,34 @@ def get_token(self) -> str | None:
73
73
)
74
74
75
75
@property
76
- def api_endpoint (self ):
77
- labels_query = "," .join (self .labels ) if self .labels else ""
78
- url = (
79
- f"https://api.github.com/repos/{ self .org } /{ self .repo } /"
80
- f"issues?labels={ labels_query } &state=all&per_page=100"
81
- )
76
+ def api_endpoint (self ) -> str :
77
+ """Create the API endpoint url
78
+
79
+ Returns
80
+ -------
81
+ str
82
+ A string representing the api endpoint to query.
83
+
84
+ Notes
85
+ -----
86
+ The rest API will look for issues that have ALL labels provided in a
87
+ query (using an AND query vs an OR query by default). The graphQL may
88
+ support OR. As such if there is a list provided, we will want to parse
89
+ down the returned list to only include issues with a specific label
90
+ included.
91
+ """
92
+ # If there is more than one label provided, request all issues
93
+ # Will have to parse later.
94
+ if len (self .labels ) > 1 :
95
+ url = (
96
+ f"https://api.github.com/repos/{ self .org } /{ self .repo } /"
97
+ f"issues?state=all&per_page=100"
98
+ )
99
+ else :
100
+ url = (
101
+ f"https://api.github.com/repos/{ self .org } /{ self .repo } /"
102
+ f"issues?labels={ self .labels [0 ]} &state=all&per_page=100"
103
+ )
82
104
return url
83
105
84
106
def handle_rate_limit (self , response ):
Original file line number Diff line number Diff line change @@ -243,7 +243,8 @@ class ReviewModel(BaseModel):
243
243
)
244
244
submitting_author : ReviewUser | None = None
245
245
all_current_maintainers : list [ReviewUser ] = Field (default_factory = list )
246
- repository_link : str
246
+ # Support presubmissions with an alias
247
+ repository_link : str = Field (..., alias = "repository_link_(if_existing)" )
247
248
version_submitted : Optional [str ] = None
248
249
categories : Optional [list [str ]] = None
249
250
editor : ReviewUser | None = None
Original file line number Diff line number Diff line change @@ -67,10 +67,25 @@ def get_issues(self) -> list[Issue]:
67
67
-------
68
68
list
69
69
List of dict items each containing a review issue
70
+
71
+ Notes
72
+ -----
73
+ We add a filter here to labels because the github api defaults to
74
+ grabbing issues with ALL using an and operator labels in a list. We
75
+ need to use an OR as a selector.
70
76
"""
71
77
72
78
issues = self .github_api .return_response ()
73
- return [Issue (** i ) for i in issues ]
79
+ # Filter labels according to label select input
80
+ labels = self .github_api .labels
81
+
82
+ filtered_issues = [
83
+ issue
84
+ for issue in issues
85
+ if any (label ["name" ] in labels for label in issue ["labels" ])
86
+ ]
87
+
88
+ return [Issue (** i ) for i in filtered_issues ]
74
89
75
90
def _is_review_role (self , string : str ) -> bool :
76
91
"""
You can’t perform that action at this time.
0 commit comments