diff --git a/src/index.js b/src/index.js index f70a6f4..f52f400 100644 --- a/src/index.js +++ b/src/index.js @@ -11,7 +11,15 @@ import { createHash } from 'crypto'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; -import githubPAT from './gh_pat.js'; +let file; +let githubPAT; +try { + file = JSON.parse(readFileSync('./gh_pat.json')); + githubPAT = file.token; +} catch (error) { + if (error.code !== 'ENOENT') throw error; + githubPAT = process.env.GHTOKEN; +} const __dirname = dirname(fileURLToPath(import.meta.url)); @@ -197,4 +205,4 @@ for (const parentRepo of ModuleRepos) { writeFileSync(`${distDir}/modules.json`, JSON.stringify(oldTotalModulesJson)); -copyFileSync(`${__dirname.replace('/src', '')}/_headers`, `${distDir}/_headers`); \ No newline at end of file +copyFileSync(`${__dirname.replace('/src', '')}/_headers`, `${distDir}/_headers`);