Migrate deprecated octokit method calls
This commit is contained in:
parent
bc135c4c2e
commit
36a6b58ed1
|
@ -67,7 +67,7 @@ async function checkOpenPullRequests (robot, context) {
|
||||||
// Fetch column IDs
|
// Fetch column IDs
|
||||||
let ghcolumns
|
let ghcolumns
|
||||||
try {
|
try {
|
||||||
const ghcolumnsPayload = await github.projects.getProjectColumns({ project_id: project.id })
|
const ghcolumnsPayload = await github.projects.listColumns({ project_id: project.id })
|
||||||
ghcolumns = ghcolumnsPayload.data
|
ghcolumns = ghcolumnsPayload.data
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
robot.log.error(`${botName} - Couldn't fetch the github columns for project: ${err}`, repoInfo, project.id)
|
robot.log.error(`${botName} - Couldn't fetch the github columns for project: ${err}`, repoInfo, project.id)
|
||||||
|
@ -85,7 +85,7 @@ async function checkOpenPullRequests (robot, context) {
|
||||||
try {
|
try {
|
||||||
// Gather all open PRs in this repo
|
// Gather all open PRs in this repo
|
||||||
const allPullRequests = await github.paginate(
|
const allPullRequests = await github.paginate(
|
||||||
github.pullRequests.getAll(context.repo({ per_page: 100 })),
|
github.pullRequests.list(context.repo({ per_page: 100 })),
|
||||||
res => res.data
|
res => res.data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ module.exports = {
|
||||||
async function _getPullRequestReviewStates (github, prInfo) {
|
async function _getPullRequestReviewStates (github, prInfo) {
|
||||||
let finalReviewsMap = new Map()
|
let finalReviewsMap = new Map()
|
||||||
const ghreviews = await github.paginate(
|
const ghreviews = await github.paginate(
|
||||||
github.pullRequests.getReviews({ ...prInfo, per_page: 100 }),
|
github.pullRequests.listReviews({ ...prInfo, per_page: 100 }),
|
||||||
res => res.data)
|
res => res.data)
|
||||||
for (const review of ghreviews) {
|
for (const review of ghreviews) {
|
||||||
switch (review.state) {
|
switch (review.state) {
|
||||||
|
@ -98,7 +98,7 @@ async function _getReviewApprovalState (context, robot, prInfo, testedPullReques
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _getProjectCardForIssue (github, columnId, issueUrl) {
|
async function _getProjectCardForIssue (github, columnId, issueUrl) {
|
||||||
const ghcardsPayload = await github.projects.getProjectCards({column_id: columnId})
|
const ghcardsPayload = await github.projects.listCards({ column_id: columnId })
|
||||||
const ghcard = ghcardsPayload.data.find(c => c.content_url === issueUrl)
|
const ghcard = ghcardsPayload.data.find(c => c.content_url === issueUrl)
|
||||||
|
|
||||||
return ghcard
|
return ghcard
|
||||||
|
@ -139,7 +139,7 @@ async function _getRepoProjectByName (github, robot, repoInfo, projectName, botN
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const ghprojectsPayload = await github.projects.getRepoProjects({ ...repoInfo, state: 'open' })
|
const ghprojectsPayload = await github.projects.listForRepo({ ...repoInfo, state: 'open' })
|
||||||
const project = ghprojectsPayload.data.find(p => p.name === projectName)
|
const project = ghprojectsPayload.data.find(p => p.name === projectName)
|
||||||
if (!project) {
|
if (!project) {
|
||||||
robot.log.error(`${botName} - Couldn't find project ${projectName} in repo ${repoInfo.owner}/${repoInfo.repo}`)
|
robot.log.error(`${botName} - Couldn't find project ${projectName} in repo ${repoInfo.owner}/${repoInfo.repo}`)
|
||||||
|
@ -164,7 +164,7 @@ async function _getProjectColumnByName (github, robot, project, columnName, botN
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const ghcolumnsPayload = await github.projects.getProjectColumns({ project_id: project.id })
|
const ghcolumnsPayload = await github.projects.listColumns({ project_id: project.id })
|
||||||
const column = ghcolumnsPayload.data.find(c => c.name === columnName)
|
const column = ghcolumnsPayload.data.find(c => c.name === columnName)
|
||||||
if (!column) {
|
if (!column) {
|
||||||
robot.log.error(`${botName} - Couldn't find ${columnName} column in project ${project.name}`)
|
robot.log.error(`${botName} - Couldn't find ${columnName} column in project ${project.name}`)
|
||||||
|
|
Loading…
Reference in New Issue