action-docs
Advanced tools
Comparing version 2.4.1 to 2.4.2
# Changelog | ||
## [2.4.2](https://github.com/npalm/action-docs/compare/v2.4.1...v2.4.2) (2024-07-03) | ||
### Bug Fixes | ||
* **deps:** bump braces from 3.0.2 to 3.0.3 in the npm_and_yarn group ([#634](https://github.com/npalm/action-docs/issues/634)) ([d250deb](https://github.com/npalm/action-docs/commit/d250debd2fd5bb7ea5a36fe21f08c6b48fe8389b)) | ||
* **deps:** bump yaml from 2.4.1 to 2.4.2 ([#601](https://github.com/npalm/action-docs/issues/601)) ([abe0bff](https://github.com/npalm/action-docs/commit/abe0bff7b1f82754fbccd0ab636c9600a2c5a3d8)) | ||
* Ignore empty inputs in workflows and actions ([#620](https://github.com/npalm/action-docs/issues/620)) ([b0b7b4e](https://github.com/npalm/action-docs/commit/b0b7b4e73acbefc900e06f9cbb7854e4ea5dc68d)) | ||
## [2.4.1](https://github.com/npalm/action-docs/compare/v2.4.0...v2.4.1) (2024-04-27) | ||
@@ -4,0 +13,0 @@ |
@@ -70,30 +70,32 @@ import { getLineBreak } from "./linebreak.js"; | ||
} | ||
codeBlockArray.push(`${indent}with:`); | ||
indent += " "; | ||
const inputs = getInputOutput(data, isAction ? InputOutputType.actionInput : InputOutputType.workflowInput, false); | ||
for (const row of inputs.rows) { | ||
const inputName = row[0]; | ||
const inputDescCommented = row[1] | ||
.split(/(\r\n|\n|\r)/gm) | ||
.filter((l) => !["", "\r", "\n", "\r\n"].includes(l)) | ||
.map((l) => `# ${l}`); | ||
const type = isAction ? undefined : row[2]; | ||
const isRequired = isAction ? row[2] : row[3]; | ||
const defaultVal = isAction ? row[3] : row[4]; | ||
const inputBlock = [`${inputName}:`]; | ||
inputBlock.push(...inputDescCommented); | ||
inputBlock.push("#"); | ||
if (type) { | ||
inputBlock.push(`# Type: ${type}`); | ||
if (data) { | ||
codeBlockArray.push(`${indent}with:`); | ||
indent += " "; | ||
for (const row of inputs.rows) { | ||
const inputName = row[0]; | ||
const inputDescCommented = row[1] | ||
.split(/(\r\n|\n|\r)/gm) | ||
.filter((l) => !["", "\r", "\n", "\r\n"].includes(l)) | ||
.map((l) => `# ${l}`); | ||
const type = isAction ? undefined : row[2]; | ||
const isRequired = isAction ? row[2] : row[3]; | ||
const defaultVal = isAction ? row[3] : row[4]; | ||
const inputBlock = [`${inputName}:`]; | ||
inputBlock.push(...inputDescCommented); | ||
inputBlock.push("#"); | ||
if (type) { | ||
inputBlock.push(`# Type: ${type}`); | ||
} | ||
inputBlock.push(`# Required: ${isRequired}`); | ||
if (defaultVal) { | ||
inputBlock.push(`# Default: ${defaultVal}`); | ||
} | ||
codeBlockArray.push(...inputBlock.map((l) => `${indent}${l}`)); | ||
codeBlockArray.push(""); | ||
} | ||
inputBlock.push(`# Required: ${isRequired}`); | ||
if (defaultVal) { | ||
inputBlock.push(`# Default: ${defaultVal}`); | ||
if (inputs.rows.length > 0) { | ||
codeBlockArray = codeBlockArray.slice(0, -1); | ||
} | ||
codeBlockArray.push(...inputBlock.map((l) => `${indent}${l}`)); | ||
codeBlockArray.push(""); | ||
} | ||
if (inputs.rows.length > 0) { | ||
codeBlockArray = codeBlockArray.slice(0, -1); | ||
} | ||
codeBlockArray.push("```"); | ||
@@ -100,0 +102,0 @@ // Create final resulting code block |
{ | ||
"name": "action-docs", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "Generate GitHub action docs based on action.yml", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -138,5 +138,2 @@ import { LineBreakType, getLineBreak } from "./linebreak.js"; | ||
codeBlockArray.push(`${indent}with:`); | ||
indent += " "; | ||
const inputs = getInputOutput( | ||
@@ -147,29 +144,35 @@ data, | ||
); | ||
for (const row of inputs.rows) { | ||
const inputName = row[0]; | ||
const inputDescCommented = row[1] | ||
.split(/(\r\n|\n|\r)/gm) | ||
.filter((l) => !["", "\r", "\n", "\r\n"].includes(l)) | ||
.map((l) => `# ${l}`); | ||
const type = isAction ? undefined : row[2]; | ||
const isRequired = isAction ? row[2] : row[3]; | ||
const defaultVal = isAction ? row[3] : row[4]; | ||
const inputBlock = [`${inputName}:`]; | ||
inputBlock.push(...inputDescCommented); | ||
inputBlock.push("#"); | ||
if (type) { | ||
inputBlock.push(`# Type: ${type}`); | ||
if (data) { | ||
codeBlockArray.push(`${indent}with:`); | ||
indent += " "; | ||
for (const row of inputs.rows) { | ||
const inputName = row[0]; | ||
const inputDescCommented = row[1] | ||
.split(/(\r\n|\n|\r)/gm) | ||
.filter((l) => !["", "\r", "\n", "\r\n"].includes(l)) | ||
.map((l) => `# ${l}`); | ||
const type = isAction ? undefined : row[2]; | ||
const isRequired = isAction ? row[2] : row[3]; | ||
const defaultVal = isAction ? row[3] : row[4]; | ||
const inputBlock = [`${inputName}:`]; | ||
inputBlock.push(...inputDescCommented); | ||
inputBlock.push("#"); | ||
if (type) { | ||
inputBlock.push(`# Type: ${type}`); | ||
} | ||
inputBlock.push(`# Required: ${isRequired}`); | ||
if (defaultVal) { | ||
inputBlock.push(`# Default: ${defaultVal}`); | ||
} | ||
codeBlockArray.push(...inputBlock.map((l) => `${indent}${l}`)); | ||
codeBlockArray.push(""); | ||
} | ||
inputBlock.push(`# Required: ${isRequired}`); | ||
if (defaultVal) { | ||
inputBlock.push(`# Default: ${defaultVal}`); | ||
if (inputs.rows.length > 0) { | ||
codeBlockArray = codeBlockArray.slice(0, -1); | ||
} | ||
codeBlockArray.push(...inputBlock.map((l) => `${indent}${l}`)); | ||
codeBlockArray.push(""); | ||
} | ||
if (inputs.rows.length > 0) { | ||
codeBlockArray = codeBlockArray.slice(0, -1); | ||
} | ||
@@ -176,0 +179,0 @@ codeBlockArray.push("```"); |
48206
923