Files
npm-audit-action/src/pr.ts
2019-12-13 12:18:28 +09:00

20 lines
427 B
TypeScript

import axios, {AxiosResponse} from 'axios'
export async function createComment(
token: string,
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`, {
body
})
}