feat: github Basic Authentication

This commit is contained in:
DIYgod
2020-02-10 01:40:24 +08:00
parent f2bb385991
commit 120d1ed38a
5 changed files with 25 additions and 13 deletions

View File

@@ -14,6 +14,10 @@ module.exports = async (ctx) => {
const host = `https://github.com/${user}/${repo}/issues`;
const url = `https://api.github.com/repos/${user}/${repo}/issues`;
const headers = {};
if (config.github && config.github.access_token) {
headers.Authorization = `token ${config.github.access_token}`;
}
const response = await got({
method: 'get',
url,
@@ -21,8 +25,8 @@ module.exports = async (ctx) => {
state: state,
labels: labels,
sort: 'created',
access_token: config.github && config.github.access_token,
}),
headers,
});
const data = response.data;