fix: treat gh CLI token as GitHub account

This commit is contained in:
Bohdan Triapitsyn
2026-06-11 19:30:19 +03:00
parent 465732858f
commit f26950fa4e
25 changed files with 196 additions and 65 deletions
+3 -2
View File
@@ -1,10 +1,11 @@
import { Octokit } from '@octokit/rest';
import { getGitHubAuth, isGhCliDisabled } from './auth.js';
import { getGitHubAuth, isGhCliActive, isGhCliDisabled } from './auth.js';
import { getGhCliToken } from './gh-cli-credential.js';
export function getOctokitOrNull() {
const auth = getGitHubAuth();
const token = auth?.accessToken || (!isGhCliDisabled() ? getGhCliToken() : null);
const ghToken = !isGhCliDisabled() ? getGhCliToken() : null;
const token = isGhCliActive() ? ghToken || auth?.accessToken : auth?.accessToken || ghToken;
if (!token) {
return null;
}