Move test & script utils out of /lib (#17517)
* Remove an unused file * Move authenticate-to-aws to scripts/utils * Move crowdin-config to tests/utils * Remove add-frontmatter-to-file * Move find-unused-assets * Move git-utils to script/utils * Move lib/github to script/utils * Revert "Remove an unused file" This reverts commit cd93ad846a0354e957359f23124eb0724c9147cf. * Move find-extraneous-translation-files to script/utils * We already have tests/helpers * Rename script/utils => helpers for consistency * Forgot a path * Fix path to crowdin-config Co-authored-by: Chiedo John <2156688+chiedo@users.noreply.github.com>
This commit is contained in:
18
script/helpers/github.js
Normal file
18
script/helpers/github.js
Normal file
@@ -0,0 +1,18 @@
|
||||
if (!process.env.GITHUB_TOKEN) {
|
||||
require('dotenv').config()
|
||||
}
|
||||
|
||||
// this module needs to work in development, production, and GitHub Actions
|
||||
//
|
||||
// GITHUB_TOKEN comes from one of the following sources:
|
||||
// 1. set in the .env file (development)
|
||||
// 2. set as a Heroku config var (staging and production)
|
||||
// 3. an installation token granted via GitHub Actions
|
||||
const apiToken = process.env.GITHUB_TOKEN
|
||||
|
||||
// See https://github.com/octokit/rest.js/issues/1207
|
||||
module.exports = function github () {
|
||||
return require('@octokit/rest')({
|
||||
auth: `token ${apiToken}`
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user