refactor: replace axios call with octokit

This commit is contained in:
Naoki Oketani
2023-04-22 13:29:59 +00:00
parent 573a1eab3d
commit 0cbdd1f2f3
7 changed files with 17 additions and 7635 deletions

View File

@@ -1,19 +1,16 @@
import axios, {AxiosResponse} from 'axios'
import {Octokit} from '@octokit/rest'
export async function createComment(
token: string,
octokit: Octokit,
owner: string,
repo: string,
prNumber: number,
body: string
): Promise<AxiosResponse> {
const instance = axios.create({
baseURL: 'https://api.github.com',
headers: {
Authorization: `token ${token}`
}
})
return instance.post(`/repos/${owner}/${repo}/issues/${prNumber}/comments`, {
): Promise<void> {
octokit.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body
})
}