New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

action-docs

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

action-docs - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

7

CHANGELOG.md
# Changelog
## [2.1.0](https://github.com/npalm/action-docs/compare/v2.0.1...v2.1.0) (2024-02-15)
### Features
* support action name attribute ([#526](https://github.com/npalm/action-docs/issues/526)) ([0e99848](https://github.com/npalm/action-docs/commit/0e998480955270e4500b38e2f2aab426c955d258))
## [2.0.1](https://github.com/npalm/action-docs/compare/v2.0.0...v2.0.1) (2024-02-14)

@@ -4,0 +11,0 @@

2

lib/action-docs.d.ts

@@ -8,2 +8,3 @@ import { LineBreakType } from "./linebreak.js";

lineBreaks?: LineBreakType;
includeNameHeader?: boolean;
}

@@ -16,2 +17,3 @@ interface DefaultOptions {

lineBreaks: LineBreakType;
includeNameHeader?: boolean;
}

@@ -18,0 +20,0 @@ export declare const defaultOptions: DefaultOptions;

@@ -14,2 +14,3 @@ import { getLineBreak } from "./linebreak.js";

lineBreaks: "LF",
includeNameHeader: false,
};

@@ -78,2 +79,3 @@ function createMdTable(data, options, type) {

if (options.updateReadme) {
await updateReadme(options, docs.header, "header", options.actionFile);
await updateReadme(options, docs.description, "description", options.actionFile);

@@ -85,3 +87,3 @@ await updateReadme(options, docs.inputs, "inputs", options.actionFile);

}
return `${docs.description + docs.inputs + docs.outputs + docs.runs}`;
return `${docs.header + docs.description + docs.inputs + docs.outputs + docs.runs}`;
}

@@ -93,3 +95,9 @@ function generateActionDocs(options) {

const outputMdTable = createMdTable(yml.outputs, options, "output");
let header = "";
if (options.includeNameHeader) {
header = createMarkdownHeader(options, yml.name);
options.tocLevel++;
}
return {
header,
description: createMarkdownSection(options, yml.description, "Description"),

@@ -135,6 +143,13 @@ inputs: createMarkdownSection(options, inputMdTable, "Inputs"),

function createMarkdownSection(options, data, header) {
return data !== ""
? `${getToc(options.tocLevel)} ${header}${getLineBreak(options.lineBreaks)}${getLineBreak(options.lineBreaks)}${data}${getLineBreak(options.lineBreaks)}${getLineBreak(options.lineBreaks)}`
: "";
const lineBreak = getLineBreak(options.lineBreaks);
return data === "" || data === undefined
? ""
: `${createMarkdownHeader(options, header)}${data}` +
`${lineBreak}` +
`${lineBreak}`;
}
function createMarkdownHeader(options, header) {
const lineBreak = getLineBreak(options.lineBreaks);
return `${getToc(options.tocLevel)} ${header}${lineBreak}${lineBreak}`;
}
function getInputOutput(data, type) {

@@ -141,0 +156,0 @@ let headers = [];

15

lib/cli.js

@@ -41,2 +41,7 @@ #!/usr/bin/env node

},
"include-name-header": {
description: "Include a header with the action/workflow name",
type: "boolean",
alias: "n",
},
})

@@ -47,4 +52,3 @@ .help().argv;

const updateReadme = args["update-readme"] !== undefined;
/* eslint-disable github/no-then */
generateActionMarkdownDocs({
const options = {
actionFile: args.action,

@@ -57,3 +61,8 @@ tocLevel: args["toc-level"],

lineBreaks: getLineBreakType(args["line-breaks"]),
})
includeNameHeader: args["include-name-header"] === undefined
? defaultOptions.includeNameHeader
: args["include-name-header"],
};
/* eslint-disable github/no-then */
generateActionMarkdownDocs(options)
.then((r) => {

@@ -60,0 +69,0 @@ if (!updateReadme) {

{
"name": "action-docs",
"version": "2.0.1",
"version": "2.1.0",
"description": "Generate GitHub action docs based on action.yml",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -58,10 +58,11 @@ <!-- BADGES/ -->

Options:
--help Show help [boolean]
--version Show version number [boolean]
-t, --toc-level TOC level used for markdown [number] [default: 2]
-a, --action GitHub action file [string] [default: "action.yml"]
--no-banner Print no banner
-u, --update-readme Update readme file. [string]
-l, --line-breaks Used line breaks in the generated docs.
[string] [choices: "CR", "LF", "CRLF"] [default: "LF"]
--help Show help [boolean]
--version Show version number [boolean]
-t, --toc-level TOC level used for markdown [number] [default: 2]
-a, --action GitHub action file [string] [default: "action.yml"]
--no-banner Print no banner
-u, --update-readme Update readme file. [string]
-l, --line-breaks Used line breaks in the generated docs.
[string] [choices: "CR", "LF", "CRLF"] [default: "LF"]
-n, --include-name-header Include a header with the action/workflow name.
```

@@ -74,2 +75,4 @@

```md
<!-- action-docs-header action="action.yml" -->
<!-- action-docs-description action="action.yml" -->

@@ -76,0 +79,0 @@

@@ -15,5 +15,7 @@ import { LineBreakType, getLineBreak } from "./linebreak.js";

lineBreaks?: LineBreakType;
includeNameHeader?: boolean;
}
interface ActionMarkdown {
header: string;
description: string;

@@ -45,2 +47,3 @@ inputs: string;

lineBreaks: LineBreakType;
includeNameHeader?: boolean;
}

@@ -54,2 +57,3 @@

lineBreaks: "LF",
includeNameHeader: false,
};

@@ -156,2 +160,3 @@

if (options.updateReadme) {
await updateReadme(options, docs.header, "header", options.actionFile);
await updateReadme(

@@ -169,3 +174,3 @@ options,

return `${docs.description + docs.inputs + docs.outputs + docs.runs}`;
return `${docs.header + docs.description + docs.inputs + docs.outputs + docs.runs}`;
}

@@ -180,3 +185,10 @@

let header = "";
if (options.includeNameHeader) {
header = createMarkdownHeader(options, yml.name);
options.tocLevel++;
}
return {
header,
description: createMarkdownSection(options, yml.description, "Description"),

@@ -251,11 +263,17 @@ inputs: createMarkdownSection(options, inputMdTable, "Inputs"),

): string {
return data !== ""
? `${getToc(options.tocLevel)} ${header}${getLineBreak(
options.lineBreaks,
)}${getLineBreak(options.lineBreaks)}${data}${getLineBreak(
options.lineBreaks,
)}${getLineBreak(options.lineBreaks)}`
: "";
const lineBreak = getLineBreak(options.lineBreaks);
return data === "" || data === undefined
? ""
: `${createMarkdownHeader(options, header)}${data}` +
`${lineBreak}` +
`${lineBreak}`;
}
function createMarkdownHeader(options: DefaultOptions, header: string): string {
const lineBreak = getLineBreak(options.lineBreaks);
return `${getToc(options.tocLevel)} ${header}${lineBreak}${lineBreak}`;
}
function getInputOutput(

@@ -262,0 +280,0 @@ data: ActionInputsOutputs,

@@ -43,2 +43,7 @@ #!/usr/bin/env node

},
"include-name-header": {
description: "Include a header with the action/workflow name",
type: "boolean",
alias: "n",
},
})

@@ -54,4 +59,3 @@ .help().argv;

/* eslint-disable github/no-then */
generateActionMarkdownDocs({
const options = {
actionFile: args.action,

@@ -65,3 +69,10 @@ tocLevel: args["toc-level"],

lineBreaks: getLineBreakType(args["line-breaks"]),
})
includeNameHeader:
args["include-name-header"] === undefined
? defaultOptions.includeNameHeader
: args["include-name-header"],
};
/* eslint-disable github/no-then */
generateActionMarkdownDocs(options)
.then((r) => {

@@ -68,0 +79,0 @@ if (!updateReadme) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc