fix: prefer token input over GITHUB_TOKEN (#751)

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen
2026-03-14 22:29:40 -04:00
committed by GitHub
parent b25b93d384
commit b36466e122
3 changed files with 53 additions and 16 deletions

View File

@@ -84,9 +84,17 @@ export const parseInputFiles = (files: string): string[] => {
.filter((pat) => pat.trim() !== '');
};
const parseToken = (env: Env): string => {
const inputToken = env.INPUT_TOKEN?.trim();
if (inputToken) {
return inputToken;
}
return env.GITHUB_TOKEN?.trim() || '';
};
export const parseConfig = (env: Env): Config => {
return {
github_token: env.GITHUB_TOKEN || env.INPUT_TOKEN || '',
github_token: parseToken(env),
github_ref: env.GITHUB_REF || '',
github_repository: env.INPUT_REPOSITORY || env.GITHUB_REPOSITORY || '',
input_name: env.INPUT_NAME,