From 139c5f9ad504f6e3f9e601cd083872419abdf5da Mon Sep 17 00:00:00 2001 From: "Sean S. LeBlanc" Date: Tue, 17 May 2022 18:27:13 -0400 Subject: [PATCH 1/2] fix: falsey default values not included fixes issue where a defined but falsey default value is not included in inputs table --- src/action-docs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/action-docs.ts b/src/action-docs.ts index 2932ea4e..07b849e6 100644 --- a/src/action-docs.ts +++ b/src/action-docs.ts @@ -189,7 +189,7 @@ function getInputOutput( rows[i].push( value.required ? `\`${String(value.required)}\`` : "`false`" ); - rows[i].push(value.default ? value.default : ""); + rows[i].push(value.default !== undefined ? value.default : ""); } } return { headers, rows }; From 7ec6adce5084db4378d105d65a215ec0ea602334 Mon Sep 17 00:00:00 2001 From: "Sean S. LeBlanc" Date: Tue, 17 May 2022 18:27:24 -0400 Subject: [PATCH 2/2] test: falsey default values not included --- __tests__/fixtures/all_fields_action.output | 1 + __tests__/fixtures/all_fields_action.yml | 6 +++++- __tests__/fixtures/all_fields_action.yml.crlf | 6 +++++- __tests__/fixtures/all_fields_action_toc1.output | 1 + __tests__/fixtures/all_fields_action_toc3_cli.output | 1 + __tests__/fixtures/all_fields_readme.output | 1 + __tests__/fixtures/all_fields_readme.output.crlf | 1 + __tests__/fixtures/all_fields_readme_filled.input | 1 + __tests__/fixtures/all_fields_readme_filled.output | 1 + 9 files changed, 17 insertions(+), 2 deletions(-) diff --git a/__tests__/fixtures/all_fields_action.output b/__tests__/fixtures/all_fields_action.output index 9018e510..7880c68f 100644 --- a/__tests__/fixtures/all_fields_action.output +++ b/__tests__/fixtures/all_fields_action.output @@ -10,6 +10,7 @@ Default test | inputB | A description B | `true` | | | inputC | A description C | `true` | C | | inputD | A description D | `false` | D | +| inputE | A description E | `false` | false | ## Outputs diff --git a/__tests__/fixtures/all_fields_action.yml b/__tests__/fixtures/all_fields_action.yml index 2882f105..4be65f94 100644 --- a/__tests__/fixtures/all_fields_action.yml +++ b/__tests__/fixtures/all_fields_action.yml @@ -16,6 +16,10 @@ inputs: description: 'A description D' required: false default: D + inputE: + description: 'A description E' + required: false + default: false outputs: outputA: @@ -25,4 +29,4 @@ outputs: runs: using: 'node12' - main: 'dist/index.js' \ No newline at end of file + main: 'dist/index.js' diff --git a/__tests__/fixtures/all_fields_action.yml.crlf b/__tests__/fixtures/all_fields_action.yml.crlf index c3bf8afe..1c45cf2f 100644 --- a/__tests__/fixtures/all_fields_action.yml.crlf +++ b/__tests__/fixtures/all_fields_action.yml.crlf @@ -16,6 +16,10 @@ inputs: description: 'A description D' required: false default: D + inputE: + description: 'A description E' + required: false + default: false outputs: outputA: @@ -25,4 +29,4 @@ outputs: runs: using: 'node12' - main: 'dist/index.js' \ No newline at end of file + main: 'dist/index.js' diff --git a/__tests__/fixtures/all_fields_action_toc1.output b/__tests__/fixtures/all_fields_action_toc1.output index f0e958ac..60b3bbf2 100644 --- a/__tests__/fixtures/all_fields_action_toc1.output +++ b/__tests__/fixtures/all_fields_action_toc1.output @@ -10,6 +10,7 @@ Default test | inputB | A description B | `true` | | | inputC | A description C | `true` | C | | inputD | A description D | `false` | D | +| inputE | A description E | `false` | false | # Outputs diff --git a/__tests__/fixtures/all_fields_action_toc3_cli.output b/__tests__/fixtures/all_fields_action_toc3_cli.output index 6232ab3b..658992c1 100644 --- a/__tests__/fixtures/all_fields_action_toc3_cli.output +++ b/__tests__/fixtures/all_fields_action_toc3_cli.output @@ -10,6 +10,7 @@ Default test | inputB | A description B | `true` | | | inputC | A description C | `true` | C | | inputD | A description D | `false` | D | +| inputE | A description E | `false` | false | ### Outputs diff --git a/__tests__/fixtures/all_fields_readme.output b/__tests__/fixtures/all_fields_readme.output index ef6b92d9..3d7409ac 100644 --- a/__tests__/fixtures/all_fields_readme.output +++ b/__tests__/fixtures/all_fields_readme.output @@ -15,6 +15,7 @@ Default test | inputB | A description B | `true` | | | inputC | A description C | `true` | C | | inputD | A description D | `false` | D | +| inputE | A description E | `false` | false | diff --git a/__tests__/fixtures/all_fields_readme.output.crlf b/__tests__/fixtures/all_fields_readme.output.crlf index 31d7fb2b..711fdfa6 100644 --- a/__tests__/fixtures/all_fields_readme.output.crlf +++ b/__tests__/fixtures/all_fields_readme.output.crlf @@ -15,6 +15,7 @@ Default test | inputB | A description B | `true` | | | inputC | A description C | `true` | C | | inputD | A description D | `false` | D | +| inputE | A description E | `false` | false | diff --git a/__tests__/fixtures/all_fields_readme_filled.input b/__tests__/fixtures/all_fields_readme_filled.input index 830fdb61..f64e2679 100644 --- a/__tests__/fixtures/all_fields_readme_filled.input +++ b/__tests__/fixtures/all_fields_readme_filled.input @@ -14,6 +14,7 @@ Default test abc | inputA | A description A | `false` | | | inputB | A description B | `true` | | | inputD | A description D | `false` | D | +| inputE | A description E | `false` | false | diff --git a/__tests__/fixtures/all_fields_readme_filled.output b/__tests__/fixtures/all_fields_readme_filled.output index ef6b92d9..3d7409ac 100644 --- a/__tests__/fixtures/all_fields_readme_filled.output +++ b/__tests__/fixtures/all_fields_readme_filled.output @@ -15,6 +15,7 @@ Default test | inputB | A description B | `true` | | | inputC | A description C | `true` | C | | inputD | A description D | `false` | D | +| inputE | A description E | `false` | false |