Skip to content

Commit 16daa88

Browse files
authored
fix: replace any types with proper NodeJS process.env type in getToken.ts (#945)
1 parent 89cc87d commit 16daa88

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/getToken.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ dotenv.config();
1010
* @returns {string} - The GitHub token.
1111
*/
1212
function 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;

0 commit comments

Comments
 (0)