Skip to content

Commit 25a5fcd

Browse files
committed
testing octokit
1 parent 238c2a1 commit 25a5fcd

File tree

4 files changed

+129
-211
lines changed

4 files changed

+129
-211
lines changed

.github/actions/assign-dependabot-reviewer/.eslintrc.js

Lines changed: 0 additions & 203 deletions
This file was deleted.

.github/actions/assign-dependabot-reviewer/assign-reviewers.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
import axios from 'axios';
22
import {setFailed} from '@actions/core';
33
import {reviewersMap} from "./config/reviewers.mjs";
4+
import { Octokit } from '@octokit/action'
45

56
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
67
const REPO = process.env.GITHUB_REPOSITORY;
78
const PR_NUMBER = process.env.PR_NUMBER;
9+
const octokit = new Octokit();
810

911
const headers = {
1012
'Authorization': `token ${GITHUB_TOKEN}`,
1113
'Accept': 'application/vnd.github.v3+json',
1214
};
1315

16+
/**
17+
* Pull the PR details from the
18+
* @returns {Promise<any>}
19+
*/
1420
async function getPRDetails() {
15-
const url = `https://github.com/api/repos/${REPO}/pulls/${PR_NUMBER}`;
16-
const response = await axios.get(url, {headers});
17-
return response.data;
21+
return await octokit.rest.pulls.get({
22+
repo: REPO,
23+
pull_number: PR_NUMBER
24+
})
1825
}
1926

2027
async function assignReviewers(team_reviewers) {

.github/actions/assign-dependabot-reviewer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
},
1010
"dependencies": {
1111
"@actions/core": "^1.10.0",
12-
"axios": "^1.3.0"
12+
"@octokit/action": "^7.0.0",
13+
"axios": "^1.7.7"
1314
},
1415
"devDependencies": {
1516
"@eslint/js": "^9.9.1",

0 commit comments

Comments
 (0)