Skip to content

Commit

Permalink
Merge pull request #306 from lo1tuma/fix-auth
Browse files Browse the repository at this point in the history
Fix token authentication
  • Loading branch information
lo1tuma committed Sep 25, 2023
2 parents 6c1a1da + 432a219 commit db74017
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/bin/pr-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ async function readJson(filePath: string): Promise<unknown> {
const prLogPackageJsonURL = new URL('../../../../package.json', import.meta.url);
const config = (await readJson(prLogPackageJsonURL.pathname)) as Record<string, string>;

// eslint-disable-next-line node/no-process-env
const { GH_TOKEN } = process.env;
const githubClient = new Octokit({ auth: GH_TOKEN });

let isTracingEnabled = false;

const changelogPath = path.join(process.cwd(), 'CHANGELOG.md');
const gitCommandRunner = createGitCommandRunner({ execute: execaCommand });
const findRemoteAlias = findRemoteAliasFactory({ gitCommandRunner });
const githubClient = new Octokit();
const getMergedPullRequests = getMergedPullRequestsFactory({
githubClient,
gitCommandRunner,
Expand All @@ -44,13 +47,10 @@ program
.option('--sloppy', 'skip ensuring clean local git state')
.option('--trace', 'show stack traces for any error')
.action(async (versionNumber: string, options: Record<string, unknown>) => {
// eslint-disable-next-line node/no-process-env
const { GH_TOKEN } = process.env;

const runOptions: RunOptions = { sloppy: options.sloppy === true, changelogPath };
isTracingEnabled = options.trace === true;
if (GH_TOKEN) {
await githubClient.auth({ type: 'token', token: GH_TOKEN });
await githubClient.auth();
}
const packageInfo = (await readJson(path.join(process.cwd(), 'package.json'))) as Record<string, unknown>;
const dependencies = {
Expand Down

0 comments on commit db74017

Please sign in to comment.