Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/node-repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function resolveLabelsThenUpdatePr (options) {
return options.logger.error(err, 'Error retrieving files from GitHub')
}

const filepathsChanged = res.map((fileMeta) => fileMeta.filename)
const filepathsChanged = res.data.map((fileMeta) => fileMeta.filename)
const resolvedLabels = resolveLabels(filepathsChanged, options.baseBranch)

fetchExistingThenUpdatePr(options, resolvedLabels)
Expand Down Expand Up @@ -111,6 +111,7 @@ function fetchExistingLabels (options, cb) {
return cb(err)
}

existingLabels = existingLabels.data || existingLabels || []
const existingLabelNames = existingLabels.map((label) => label.name)

// cache labels so we don't have to fetch these *all the time*
Expand All @@ -129,11 +130,12 @@ function fetchLabelPages (options, startPageNum, cb) {
repo: options.repo,
page: startPageNum,
per_page: 100
}, (err, existingLabels) => {
}, (err, res) => {
const existingLabels = res.data || []
if (err) {
return cb(err)
}
if (!githubClient.hasNextPage(existingLabels)) {
if (!githubClient.hasNextPage(res)) {
return cb(null, existingLabels)
}
fetchLabelPages(
Expand Down
5 changes: 3 additions & 2 deletions lib/push-jenkins-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ function findLatestCommitInPr (options, cb, pageNumber = 1) {
number: options.pr,
page: pageNumber,
per_page: 100
}, (err, commitMetas) => {
}, (err, res) => {
const commitMetas = res.data || []
if (err) {
return cb(err)
}

const lastPageURL = githubClient.hasLastPage(commitMetas)
const lastPageURL = githubClient.hasLastPage(res)
if (lastPageURL) {
return findLatestCommitInPr(options, cb, pageNumberFromURL(lastPageURL))
}
Expand Down
Loading