Skip to content

Commit be17f71

Browse files
authored
Fix backport GitHub Action (#52938)
The octokit client we get from @actions/github recently changed their API.
1 parent d93d531 commit be17f71

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

eng/actions/backport/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ async function run() {
3131
try {
3232
// verify the comment user is a repo collaborator
3333
try {
34-
await octokit.repos.checkCollaborator({
34+
await octokit.rest.repos.checkCollaborator({
3535
owner: repo_owner,
3636
repo: repo_name,
3737
username: comment_user
3838
});
3939
console.log(`Verified ${comment_user} is a repo collaborator.`);
40-
} catch {
40+
} catch (error) {
41+
console.log(error);
4142
throw new BackportException(`Error: @${comment_user} is not a repo collaborator, backporting is not allowed.`);
4243
}
4344

@@ -125,7 +126,7 @@ async function run() {
125126
.replace(/%cc_users%/g, cc_users);
126127

127128
// open the GitHub PR
128-
await octokit.pulls.create({
129+
await octokit.rest.pulls.create({
129130
owner: repo_owner,
130131
repo: repo_name,
131132
title: backport_pr_title,
@@ -142,7 +143,7 @@ async function run() {
142143
if (error.postToGitHub === undefined || error.postToGitHub == true) {
143144
// post failure to GitHub comment
144145
const unknown_error_body = `@${comment_user} an error occurred while backporting to ${target_branch}, please check the run log for details!\n\n${error.message}`;
145-
await octokit.issues.createComment({
146+
await octokit.rest.issues.createComment({
146147
owner: repo_owner,
147148
repo: repo_name,
148149
issue_number: pr_number,

0 commit comments

Comments
 (0)