Skip to content

Commit

Permalink
chore: dep 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
juno7803 committed Oct 7, 2023
1 parent 5eb0daf commit 3f9837f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/actions/assign-reviewer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { Octokit } = require('@octokit/action');

// TODO: env로 빼기
const reviewers = ['juno7803', 'Tekiter', 'NamJwong', 'seojisoosoo'];

// 랜덤 리뷰어 선택
const selectedReviewer = reviewers[Math.floor(Math.random() * reviewers.length)];

// TODO: env로 빼기
const authToken = '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';
const owner = process.env.GITHUB_OWNER;
const repo = process.env.REPO_NAME;
const prNumber = process.env.PR_NUMBER;

const octokit = new Octokit({ auth: authToken });

try {
await octokit.request(`POST /repos/${owner}/${repo}/pulls/${prNumber}/requested_reviewers`, {
owner,
repo,
pull_number: prNumber,
reviewers: [selectedReviewer],
headers: {
'X-GitHub-Api-Version': '2022-11-28',
},
});
console.log(`${selectedReviewer}를 리뷰어로 선정했어요!`);
} catch (error) {
console.error('리뷰어 지정 과정에서 오류가 발생했어요.\n', (error.response && error.response.data) || error.message);
}
8 changes: 8 additions & 0 deletions .github/actions/assign-reviewer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "assign-reviewer",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"@octokit/action": "^6.0.6"
}
}

0 comments on commit 3f9837f

Please sign in to comment.