mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-05-10 18:44:19 +00:00
support multi-line delimited assets. fixes #15
This commit is contained in:
parent
a6281eb824
commit
3af8783d41
4 changed files with 80 additions and 5 deletions
13
src/util.ts
13
src/util.ts
|
@ -15,6 +15,17 @@ export interface Config {
|
|||
|
||||
type Env = { [key: string]: string | undefined };
|
||||
|
||||
export const parseInputFiles = (files: string): string[] => {
|
||||
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 || "",
|
||||
|
@ -23,7 +34,7 @@ export const parseConfig = (env: Env): Config => {
|
|||
input_name: env.INPUT_NAME,
|
||||
input_body: env.INPUT_BODY,
|
||||
input_body_path: env.INPUT_BODY_PATH,
|
||||
input_files: (env.INPUT_FILES || "").split(","),
|
||||
input_files: parseInputFiles(env.INPUT_FILES || ""),
|
||||
input_draft: env.INPUT_DRAFT === "true"
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue