File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -41,13 +41,24 @@ function getVersion() {
4141}
4242
4343function getGitHubToken ( ) {
44- // Check environment variables (in order of preference)
45- return (
46- process . env . GITHUB_TOKEN ||
47- process . env . GH_TOKEN ||
48- process . env . GITHUB_PAT ||
49- null
50- ) ;
44+ // Check environment variables first
45+ if ( process . env . GITHUB_TOKEN ) return process . env . GITHUB_TOKEN ;
46+ if ( process . env . GH_TOKEN ) return process . env . GH_TOKEN ;
47+
48+ // Try gh CLI (GitHub's official CLI)
49+ try {
50+ const token = execSync ( "gh auth token" , {
51+ encoding : "utf8" ,
52+ stdio : [ "pipe" , "pipe" , "pipe" ] ,
53+ } ) . trim ( ) ;
54+ if ( token && token . startsWith ( "gh" ) ) {
55+ return token ;
56+ }
57+ } catch {
58+ // gh CLI not installed or not logged in
59+ }
60+
61+ return null ;
5162}
5263
5364function httpsGet ( url , token = null ) {
You can’t perform that action at this time.
0 commit comments