Skip to content

Commit

Permalink
fix(gh-actions): Handle deleted comment authors
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthachatterjee committed Aug 8, 2019
1 parent 22339e1 commit 9fecbe7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/actions/high-priority-prs/src/pr-message.js
Expand Up @@ -43,8 +43,12 @@ module.exports = (queues, maintainers, now = new Date()) => {

let text = ``
queues[key].slice(0, 14).map((pr, i) => {
const participated = _.uniqBy(pr.comments.nodes, c => c.author.url)
.filter(comment => maintainers[comment.author.url])
const participated = _.uniqBy(pr.comments.nodes, c =>
c.author ? c.author.url : ""
)
.filter(comment => {
return comment.author ? maintainers[comment.author.url] : false
})
.map(comment => `<${maintainers[comment.author.url].slackUsername}>`)

const participatedStr =
Expand Down
8 changes: 5 additions & 3 deletions .github/actions/high-priority-prs/src/process-data.js
Expand Up @@ -123,7 +123,9 @@ const processData = (data, now = new Date()) => {
pr.participants = {}
pr.participants.nodes = _.uniqBy(
pr.comments.nodes
.filter(c => c.author.url != pr.author.url)
.filter(c => {
return c.author && pr.author && c.author.url != pr.author.url
})
.map(c => {
return { url: c.author.url }
}),
Expand Down Expand Up @@ -164,11 +166,11 @@ const processData = (data, now = new Date()) => {
// What PRs have commits (aka activity) since the last comment by
// a maintainer.
prs.nodes.forEach(pr => {
const authorUrl = pr.author.url
const authorUrl = pr.author ? pr.author.url : ""
const botUrl = "https://github.com/apps/gatsbot"

const reviewList = pr.comments.nodes.filter(
x => x.author.url !== authorUrl && x.author.url !== botUrl
x => x.author && x.author.url !== authorUrl && x.author.url !== botUrl
)
const lastComment = _.get(
_.maxBy(reviewList, n => n.createdAt),
Expand Down

0 comments on commit 9fecbe7

Please sign in to comment.