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

Generate GitHub action docs based on action.yml

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

example workflow npm Maintainability Rating Coverage CodeScene Code Health

Action docs

A CLI to generate and update documentation for GitHub actions, based on the action definition .yml. To update your README in a GitHub workflow you can use the action-docs-action.

TL;DR

Add the following comment blocks to your README.md

<!-- action-docs-description action="action.yml" -->

<!-- action-docs-inputs action="action.yml" -->

<!-- action-docs-outputs action="action.yml" -->

<!-- action-docs-runs action="action.yml" -->

Optionally you can also add the following section to generate a usage guide, replacing <project> and <version> with the name and version of your project you would like to appear in your usage guide.

<!-- action-docs-usage action="action.yml" project="<project>" version="<version>" -->

Generate docs via CLI

npm install -g action-docs
cd <your github action>

# write docs to console
action-docs

# update README
action-docs --update-readme

Run the cli

action-docs -u

CLI

Options

The following options are available via the CLI

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"]

Update the README

Action-docs can update your README based on the action.yml. The following sections can be updated: description, inputs, outputs and runs. Add the following tags to your README and run action-docs -u.

<!-- action-docs-description action="action.yml" -->

<!-- action-docs-inputs action="action.yml" -->

<!-- action-docs-outputs action="action.yml" -->

<!-- action-docs-runs action="action.yml" -->

For updating other Markdown files add the name of the file to the command action-docs -u <file>.

If you need to use another/action.yml:

  1. write it in tags like action="another/action.yml";
  2. specify in a command via the -a option like action-docs -a another/action.yml

Examples

Print action markdown docs to console
action-docs
Update README.md
action-docs --update-readme
Print action markdown for non default action file
action-docs --action another/action.yaml
Update readme, custom action file and set TOC level 3, custom readme
action-docs --action ./some-dir/action.yml --toc-level 3 --update-readme docs.md

API

import { generateActionMarkdownDocs } from 'action-docs'

await generateActionMarkdownDocs({
  actionFile: 'action.yml'
  tocLevel: 2
  updateReadme: true
  readmeFile: 'README.md'
});

Contribution

We welcome contributions, please checkout the contribution guide.

License

This project is released under the MIT License.

Keywords

FAQs

Package last updated on 14 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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