| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 5x 2x 3x 1x 3x 3x 1x 3x | import GitHubAPI from 'github';
export default class GitHub {
constructor(authToken) {
if (authToken) {
this.token = authToken;
} else if (process.env.GITHUB_TOKEN) {
this.token = process.env.GITHUB_TOKEN;
}
}
getGitHub() {
const github = new GitHubAPI({
protocol: 'https',
headers: {
'user-agent': 'Electron Forge',
},
});
if (this.token) {
github.authenticate({
type: 'token',
token: this.token,
});
}
return github;
}
}
|