mirror of
https://github.com/softprops/action-gh-release.git
synced 2026-03-18 12:19:01 +08:00
fix: prefer token input over GITHUB_TOKEN (#751)
Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
10
src/util.ts
10
src/util.ts
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user