mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-10 10:44:19 +00:00
Update util.ts
This commit is contained in:
parent
f32afa1040
commit
b50af5142f
1 changed files with 14 additions and 0 deletions
14
src/util.ts
14
src/util.ts
|
@ -12,6 +12,7 @@ export interface Config {
|
|||
input_body?: string;
|
||||
input_body_path?: string;
|
||||
input_files?: string[];
|
||||
input_filelist?: string;
|
||||
input_draft?: boolean;
|
||||
input_prerelease?: boolean;
|
||||
input_fail_on_unmatched_files?: boolean;
|
||||
|
@ -50,6 +51,18 @@ export const parseInputFiles = (files: string): string[] => {
|
|||
);
|
||||
};
|
||||
|
||||
export const parseInputListfile = (filelist: string): string[] => {
|
||||
files = readFileSync(filelist).toString("utf8"))
|
||||
return files.split(/\r?\n/).reduce<string[]>(
|
||||
(acc, line) =>
|
||||
acc
|
||||
.concat(line.split(","))
|
||||
.filter((pat) => pat)
|
||||
.map((pat) => pat.trim()),
|
||||
[]
|
||||
);
|
||||
};
|
||||
|
||||
export const parseConfig = (env: Env): Config => {
|
||||
return {
|
||||
github_token: env.GITHUB_TOKEN || env.INPUT_TOKEN || "",
|
||||
|
@ -60,6 +73,7 @@ export const parseConfig = (env: Env): Config => {
|
|||
input_body: env.INPUT_BODY,
|
||||
input_body_path: env.INPUT_BODY_PATH,
|
||||
input_files: parseInputFiles(env.INPUT_FILES || ""),
|
||||
input_filelist: parseInputListfile(env.INPUT_FILELIST || ""),
|
||||
input_draft: env.INPUT_DRAFT ? env.INPUT_DRAFT === "true" : undefined,
|
||||
input_prerelease: env.INPUT_PRERELEASE
|
||||
? env.INPUT_PRERELEASE == "true"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue