未验证 提交 be17f71b 编写于 作者: A Alexander Köplinger 提交者: GitHub

Fix backport GitHub Action (#52938)

The octokit client we get from @actions/github recently changed their API.
上级 d93d5318
...@@ -31,13 +31,14 @@ async function run() { ...@@ -31,13 +31,14 @@ async function run() {
try { try {
// verify the comment user is a repo collaborator // verify the comment user is a repo collaborator
try { try {
await octokit.repos.checkCollaborator({ await octokit.rest.repos.checkCollaborator({
owner: repo_owner, owner: repo_owner,
repo: repo_name, repo: repo_name,
username: comment_user username: comment_user
}); });
console.log(`Verified ${comment_user} is a repo collaborator.`); console.log(`Verified ${comment_user} is a repo collaborator.`);
} catch { } catch (error) {
console.log(error);
throw new BackportException(`Error: @${comment_user} is not a repo collaborator, backporting is not allowed.`); throw new BackportException(`Error: @${comment_user} is not a repo collaborator, backporting is not allowed.`);
} }
...@@ -125,7 +126,7 @@ async function run() { ...@@ -125,7 +126,7 @@ async function run() {
.replace(/%cc_users%/g, cc_users); .replace(/%cc_users%/g, cc_users);
// open the GitHub PR // open the GitHub PR
await octokit.pulls.create({ await octokit.rest.pulls.create({
owner: repo_owner, owner: repo_owner,
repo: repo_name, repo: repo_name,
title: backport_pr_title, title: backport_pr_title,
...@@ -142,7 +143,7 @@ async function run() { ...@@ -142,7 +143,7 @@ async function run() {
if (error.postToGitHub === undefined || error.postToGitHub == true) { if (error.postToGitHub === undefined || error.postToGitHub == true) {
// post failure to GitHub comment // post failure to GitHub comment
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}`; 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}`;
await octokit.issues.createComment({ await octokit.rest.issues.createComment({
owner: repo_owner, owner: repo_owner,
repo: repo_name, repo: repo_name,
issue_number: pr_number, issue_number: pr_number,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册