Skip to content

Commit

Permalink
Fix typings and add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
richarddavison committed Sep 9, 2024
1 parent 498f21d commit 5923476
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions __tests__/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe("util", () => {
input_body_path: undefined,
input_draft: false,
input_prerelease: false,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand All @@ -67,6 +68,7 @@ describe("util", () => {
input_body_path: "__tests__/release.txt",
input_draft: false,
input_prerelease: false,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand All @@ -88,6 +90,7 @@ describe("util", () => {
input_body_path: "__tests__/release.txt",
input_draft: false,
input_prerelease: false,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand Down Expand Up @@ -121,6 +124,7 @@ describe("util", () => {
input_body_path: undefined,
input_draft: undefined,
input_prerelease: undefined,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand Down Expand Up @@ -148,6 +152,7 @@ describe("util", () => {
input_draft: undefined,
input_prerelease: undefined,
input_files: [],
input_preserve_order: undefined,
input_name: undefined,
input_tag_name: undefined,
input_fail_on_unmatched_files: false,
Expand All @@ -173,6 +178,7 @@ describe("util", () => {
input_draft: undefined,
input_prerelease: undefined,
input_files: [],
input_preserve_order: undefined,
input_name: undefined,
input_tag_name: undefined,
input_fail_on_unmatched_files: false,
Expand All @@ -198,6 +204,7 @@ describe("util", () => {
input_body_path: undefined,
input_draft: undefined,
input_prerelease: undefined,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand All @@ -215,6 +222,7 @@ describe("util", () => {
parseConfig({
INPUT_DRAFT: "false",
INPUT_PRERELEASE: "true",
INPUT_PRESERVE_ORDER: "true",
GITHUB_TOKEN: "env-token",
INPUT_TOKEN: "input-token",
}),
Expand All @@ -227,6 +235,7 @@ describe("util", () => {
input_body_path: undefined,
input_draft: false,
input_prerelease: true,
input_preserve_order: true,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand Down Expand Up @@ -254,6 +263,7 @@ describe("util", () => {
input_body_path: undefined,
input_draft: false,
input_prerelease: true,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand All @@ -280,6 +290,7 @@ describe("util", () => {
input_body_path: undefined,
input_draft: false,
input_prerelease: true,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand All @@ -305,6 +316,7 @@ describe("util", () => {
input_body_path: undefined,
input_draft: undefined,
input_prerelease: undefined,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand All @@ -330,6 +342,7 @@ describe("util", () => {
input_body_path: undefined,
input_draft: undefined,
input_prerelease: undefined,
input_preserve_order: undefined,
input_files: [],
input_name: undefined,
input_tag_name: undefined,
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ inputs:
prerelease:
description: "Identify the release as a prerelease. Defaults to false"
required: false
preserve_order:
description: "Preserver the order of the artifacts when uploading"
required: false
files:
description: "Newline-delimited list of path globs for asset files to upload"
required: false
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async function run() {
};

let assets;
if (config.preserve_order) {
if (!config.input_preserve_order) {
assets = await Promise.all(files.map(uploadFile));
} else {
assets = [];
Expand Down
4 changes: 4 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface Config {
input_body_path?: string;
input_files?: string[];
input_draft?: boolean;
input_preserve_order?: boolean;
input_prerelease?: boolean;
input_fail_on_unmatched_files?: boolean;
input_target_commitish?: string;
Expand Down Expand Up @@ -62,6 +63,9 @@ export const parseConfig = (env: Env): Config => {
input_body_path: env.INPUT_BODY_PATH,
input_files: parseInputFiles(env.INPUT_FILES || ""),
input_draft: env.INPUT_DRAFT ? env.INPUT_DRAFT === "true" : undefined,
input_preserve_order: env.INPUT_PRESERVE_ORDER
? env.INPUT_PRESERVE_ORDER == "true"
: undefined,
input_prerelease: env.INPUT_PRERELEASE
? env.INPUT_PRERELEASE == "true"
: undefined,
Expand Down

0 comments on commit 5923476

Please sign in to comment.