File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,15 +10,15 @@ dotenv.config();
1010 * @returns {string } - The GitHub token.
1111 */
1212function getToken ( bearerHeader : boolean ) : string {
13- const getEnvirontment : any = process . env ;
14- let getGHEnvirontment : any = Object . keys ( getEnvirontment ) . filter ( ( key ) =>
13+ const getEnvironment = process . env as Record < string , string | undefined > ;
14+ const getGHEnvironmentKeys = Object . keys ( getEnvironment ) . filter ( ( key ) =>
1515 key . startsWith ( "GH_TOKEN" )
1616 ) ;
17- getGHEnvirontment = getGHEnvirontment . map ( ( key : string ) => getEnvirontment [ key ] ) ;
17+ const getGHEnvironmentValues = getGHEnvironmentKeys . map ( ( key : string ) => getEnvironment [ key ] ) ;
1818
1919 // Select a random GitHub environment variable
2020 let getGHToken : string =
21- getGHEnvirontment [ Math . floor ( Math . random ( ) * getGHEnvirontment . length ) ] ;
21+ getGHEnvironmentValues [ Math . floor ( Math . random ( ) * getGHEnvironmentValues . length ) ] || "" ;
2222
2323 // If no GitHub environment variable is found, get the token from GitHub Actions inputs
2424 if ( ! getGHToken ) {
@@ -36,4 +36,4 @@ const getEnvirontment: any = process.env;
3636 return getGHToken ;
3737}
3838
39- export default getToken ;
39+ export default getToken ;
You can’t perform that action at this time.
0 commit comments