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
|
||||
let ghcolumns
|
||||
try {
|
||||
const ghcolumnsPayload = await github.projects.getProjectColumns({ project_id: project.id })
|
||||
const ghcolumnsPayload = await github.projects.listColumns({ project_id: project.id })
|
||||
ghcolumns = ghcolumnsPayload.data
|
||||
} catch (err) {
|
||||
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 {
|
||||
// Gather all open PRs in this repo
|
||||
const allPullRequests = await github.paginate(
|
||||
github.pullRequests.getAll(context.repo({ per_page: 100 })),
|
||||
github.pullRequests.list(context.repo({ per_page: 100 })),
|
||||
res => res.data
|
||||
)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
async function _getPullRequestReviewStates (github, prInfo) {
|
||||
let finalReviewsMap = new Map()
|
||||
const ghreviews = await github.paginate(
|
||||
github.pullRequests.getReviews({ ...prInfo, per_page: 100 }),
|
||||
github.pullRequests.listReviews({ ...prInfo, per_page: 100 }),
|
||||
res => res.data)
|
||||
for (const review of ghreviews) {
|
||||
switch (review.state) {
|
||||
|
@ -98,7 +98,7 @@ async function _getReviewApprovalState (context, robot, prInfo, testedPullReques
|
|||
}
|
||||
|
||||
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)
|
||||
|
||||
return ghcard
|
||||
|
@ -139,7 +139,7 @@ async function _getRepoProjectByName (github, robot, repoInfo, projectName, botN
|
|||
}
|
||||
|
||||
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)
|
||||
if (!project) {
|
||||
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 {
|
||||
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)
|
||||
if (!column) {
|
||||
robot.log.error(`${botName} - Couldn't find ${columnName} column in project ${project.name}`)
|
||||
|
|
Loading…
Reference in New Issue