Generate docs for GitHub actions
  • TypeScript 91.7%
  • JavaScript 7.5%
  • Dockerfile 0.8%
Find a file
2025-06-13 08:11:06 +02:00
.devcontainer fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
.github chore: trigger release from latest release 2025-06-13 08:11:06 +02:00
.vscode fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
__tests__ fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
src fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
.cspell.json fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
.editorconfig feat: support CR and CRLF line breaks (#13) 2021-03-07 12:03:46 +01:00
.eslintignore feat: Allow creating of usage guide (#401) 2023-04-07 22:50:02 +02:00
.eslintrc.json fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
.gitignore chore: add megalinter (#531) 2024-02-15 00:11:25 +01:00
.jscpd.json chore: add megalinter (#531) 2024-02-15 00:11:25 +01:00
.markdownlintignore chore: add megalinter (#531) 2024-02-15 00:11:25 +01:00
.mega-linter.yml fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
.nvmrc chore: dependencies and refactor ci (#506) 2024-02-04 15:21:02 +01:00
.prettierignore chore: add megalinter (#531) 2024-02-15 00:11:25 +01:00
.release-please-manifest.json chore: trigger release from latest release 2025-06-13 08:11:06 +02:00
.trivyignore chore: get devcontainer to pass trivy linting (#721) 2024-10-18 17:52:50 +02:00
CHANGELOG.md fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
CODE_OF_CONDUCT.md chore: add megalinter (#531) 2024-02-15 00:11:25 +01:00
CONTRIBUTING.md feat: support document generation for workflows (#523) 2024-03-06 22:09:49 +01:00
LICENSE feat: action docs 2021-02-20 18:51:32 +01:00
package.json fix: upgrade dependencies and bump yarn (#839) 2025-06-13 07:45:04 +02:00
README.md feat: add 'all' option to add all the documentation to the readme in one go (#537) 2024-03-09 15:25:04 +01:00
sonar-project.properties chore: collecting covrage for sonar (#578) 2024-03-31 15:14:08 +02:00
tsconfig.json fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
vitest.config.ts fix(deps): update replace-in-file and use vitest (#832) 2025-06-11 22:41:45 +02:00
yarn.lock fix: upgrade dependencies and bump yarn (#839) 2025-06-13 07:45:04 +02:00

example workflow npm Maintainability Rating Coverage CodeScene Code Health

Action docs

A CLI to generate and update documentation for GitHub actions or workflows, based on the 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-header source="action.yml" -->

<!-- action-docs-description source="action.yml" --> # applicable for actions only

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

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

<!-- action-docs-runs source="action.yml" --> # applicable for actions only

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 source="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:
      --version              Show version number                       [boolean]
  -t, --toc-level            TOC level used for markdown   [number] [default: 2]
  -a, --action               GitHub action file
             [deprecated: use "source" instead] [string] [default: "action.yml"]
  -s, --source               GitHub source 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
                                                                       [boolean]
      --help                 Show help                                 [boolean]

Update the README

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

<!-- action-docs-header source="action.yml" -->

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

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

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

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

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

Or to include all of the above, use:

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

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 source="another/action.yml";
  2. specify in a command via the -s option like action-docs -s 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 --source another/action.yaml

Update readme, custom action file and set TOC level 3, custom readme

action-docs --source ./some-dir/action.yml --toc-level 3 --update-readme docs.md

API

import { generateActionMarkdownDocs } from 'action-docs'

await generateActionMarkdownDocs({
  sourceFile: '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.