Migrate deprecated octokit method calls

This commit is contained in:
Pedro Pombeiro 2019-01-31 15:50:23 +01:00
parent 3b2436f89b
commit a0985442c0
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
7 changed files with 8 additions and 8 deletions

View File

@ -188,7 +188,7 @@ async function assignPullRequestToCorrectColumn (context, robot, repo, pullReque
robot.log.info(`Would have created card in ${dstColumn.name} column for PR #${prInfo.number}`)
} else {
// It wasn't in either the source nor the destination columns, let's create a new card for it in the destination column
const ghcardPayload = await github.projects.createProjectCard({
const ghcardPayload = await github.projects.createCard({
column_id: dstColumn.id,
content_type: 'PullRequest',
content_id: pullRequest.id

View File

@ -55,7 +55,7 @@ async function assignPullRequestToReview (context, robot) {
if (process.env.DRY_RUN) {
robot.log.debug(`${botName} - Would have created card`, column.id, payload.pull_request.id)
} else {
const ghcardPayload = await github.projects.createProjectCard({
const ghcardPayload = await github.projects.createCard({
column_id: column.id,
content_type: 'PullRequest',
content_id: payload.pull_request.id

View File

@ -80,7 +80,7 @@ async function assignIssueToBountyAwaitingForApproval (context, robot, assign) {
if (assign) {
try {
// Create project card for the issue in the bounty-awaiting-approval column
const ghcardPayload = await github.projects.createProjectCard({
const ghcardPayload = await github.projects.createCard({
column_id: column.id,
content_type: 'Issue',
content_id: payload.issue.id

View File

@ -70,7 +70,7 @@ async function assignIssueToBountyBug (context, robot, assign) {
if (assign) {
try {
// Create project card for the issue in the bounty-bug column
const ghcardPayload = await github.projects.createProjectCard({
const ghcardPayload = await github.projects.createCard({
column_id: column.id,
content_type: 'Issue',
content_id: payload.issue.id

View File

@ -126,7 +126,7 @@ async function getCheckListComment (context) {
const owner = context.payload.repository.owner.login
const repo = context.payload.repository.name
const number = context.payload.pull_request.number
const comments = await context.github.paginate(context.github.issues.getComments({ owner, repo, number }), res => res.data)
const comments = await context.github.paginate(context.github.issues.listComments({ owner, repo, number }), res => res.data)
for (const comment of comments) {
const { found } = checkPRChecklist(comment.body)
if (found) {

View File

@ -146,7 +146,7 @@ module.exports = class Stale {
if (closeComment) {
await this.github.issues.createComment({ owner, repo, number, body: closeComment })
}
return this.github.issues.edit({ owner, repo, number, state: 'closed' })
return this.github.issues.update({ owner, repo, number, state: 'closed' })
} else {
this.logger.info('%s/%s#%d would have been closed (dry-run)', owner, repo, number)
}

View File

@ -65,7 +65,7 @@ async function processChangedProjectCard (robot, context) {
let inTestColumn
try {
const columnPayload = await github.projects.getProjectColumn({ id: payload.project_card.column_id })
const columnPayload = await github.projects.getColumn({ column_id: payload.project_card.column_id })
if (columnPayload.data.name !== testColumnName) {
robot.log.trace(`${botName} - Card column name doesn't match watched column name, exiting`, columnPayload.data.name, testColumnName)
@ -84,7 +84,7 @@ async function processChangedProjectCard (robot, context) {
try {
const projectId = last(inTestColumn.project_url.split('/'), -1)
const projectPayload = await github.projects.getProject({ id: projectId })
const projectPayload = await github.projects.get({ project_id: projectId })
const project = projectPayload.data
if (project.name !== projectBoardName) {
robot.log.trace(`${botName} - Project board name doesn't match watched project board, exiting`, project.name, projectBoardName)