Skip to content

Commit

Permalink
fix(actions): fix PR bot action via await on each report call (#15665)
Browse files Browse the repository at this point in the history
* fix: await each report and protect access to requested reviewer

* fix: better promise structure based on wards suggestions

* Update .github/actions/high-priority-prs/src/index.js

Co-Authored-By: Sidhartha Chatterjee <me@sidharthachatterjee.com>
  • Loading branch information
2 people authored and GatsbyJS Bot committed Jul 12, 2019
1 parent 28aeffe commit abbee7b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/actions/high-priority-prs/src/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const filter = (queues, team) => {
Object.keys(queues).forEach(key => {
filteredQueues[key] = queues[key].filter(pr => {
return pr.reviewRequests.nodes
.map(node => node.requestedReviewer.id)
.map(node => {
if (node.requestedReviewer) {
return node.requestedReviewer.id
}
})
.includes(team.id)
})
})
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/high-priority-prs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ const start = async function() {
const data = await fetch()
if (data) {
const queues = processData(data)
teams.forEach(team => {
await Promise.all(teams.map(team => {
if (team.name === `core`) {
// send report of all PRs (without filtering) to Core
report({ queues, channelId: team.channelId })
return report({ queues, channelId: team.channelId })
} else {
// send filtered reports to respective teams
report(filter(queues, team))
return report(filter(queues, team))
}
})
}))
}
}

Expand Down
4 changes: 4 additions & 0 deletions .github/actions/high-priority-prs/src/process-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ const maintainers = {
name: "Kyle Gill",
slackUsername: "@kylegill",
},
"https://github.com/amberleyromo": {
name: "Amberley Romo",
slackUsername: "@amberley",
},
}

const ignoreMessages = ["Merge branch 'master'", "Merge remote-tracking branch"]
Expand Down

0 comments on commit abbee7b

Please sign in to comment.