@@ -190,38 +190,50 @@ async function hasLabel(name, owner, repo, issueNumber, github, core) {
190190}
191191
192192/**
193- * Fetches issues assigned to a user .
193+ * Fetches issues assigned to an assignee in given repositories .
194194 */
195- async function getIssues ( assignee , state , owner , repo , github , core ) {
196- try {
197- const response = await github . rest . issues . listForRepo ( {
198- owner,
199- repo,
200- assignee,
201- state,
202- } ) ;
203- return response . data . filter ( issue => ! issue . pull_request ) ;
204- } catch ( error ) {
205- core . warning ( `Failed to fetch issues: ${ error . message } ` ) ;
206- return [ ] ;
195+ async function getIssues ( assignee , state , owner , repos , github , core ) {
196+ const allIssues = [ ] ;
197+
198+ for ( const repo of repos ) {
199+ try {
200+ const response = await github . rest . issues . listForRepo ( {
201+ owner,
202+ repo,
203+ assignee,
204+ state,
205+ } ) ;
206+ const issues = response . data . filter ( issue => ! issue . pull_request ) ;
207+ allIssues . push ( ...issues ) ;
208+ } catch ( error ) {
209+ core . warning ( `Failed to fetch issues from ${ repo } : ${ error . message } ` ) ;
210+ }
207211 }
212+
213+ return allIssues ;
208214}
209215
210216/**
211- * Fetches pull requests for an author.
217+ * Fetches pull requests by an author in given repositories .
212218 */
213- async function getPullRequests ( author , state , owner , repo , github , core ) {
214- try {
215- const response = await github . rest . pulls . list ( {
216- owner,
217- repo,
218- state,
219- } ) ;
220- return response . data . filter ( pr => pr . user . login === author ) ;
221- } catch ( error ) {
222- core . warning ( `Failed to fetch pull requests: ${ error . message } ` ) ;
223- return [ ] ;
219+ async function getPullRequests ( author , state , owner , repos , github , core ) {
220+ const allPRs = [ ] ;
221+
222+ for ( const repo of repos ) {
223+ try {
224+ const response = await github . rest . pulls . list ( {
225+ owner,
226+ repo,
227+ state,
228+ } ) ;
229+ const prs = response . data . filter ( pr => pr . user . login === author ) ;
230+ allPRs . push ( ...prs ) ;
231+ } catch ( error ) {
232+ core . warning ( `Failed to fetch pull requests from ${ repo } : ${ error . message } ` ) ;
233+ }
224234 }
235+
236+ return allPRs ;
225237}
226238
227239module . exports = {
0 commit comments