Skip to content

@stephansama actions / generate-md-action-inputs

Generate Markdown from Action Inputs

[!CAUTION] This action is deprecated please use the cli @stephansama/auto-readme instead as it is more feature-filled

This GitHub Action automatically generates a Markdown table of your action's inputs and adds it to your README.md. It's a simple way to keep your documentation in sync with your action.yml file.

Why use this action?

  • Automated Documentation: No more manually updating your README.md every time you change an input in your action.yml.
  • Improved Discoverability: A clear and concise table of inputs makes it easier for users to understand and use your action.
  • Professional Look: A well-documented action is a sign of a quality project.

Before and After

Before:

markdown
<!-- ACTION start -->
<!-- ACTION end -->

After:

markdown
<!-- ACTION start -->

| Name       | Default         | Description               | Required |
| ---------- | --------------- | ------------------------- | -------- |
| `my-input` | `default-value` | This is my amazing input. | `false`  |

<!-- ACTION end -->

Usage

  1. Add the comment block to your README.md:

    Add the following comment block to your README.md where you want the table of inputs to be generated:

    markdown
    <!-- ACTION start -->
    <!-- ACTION end -->
  2. Create a workflow file:

    Create a new workflow file in your .github/workflows directory (e.g., .github/workflows/docs.yml) with the following content:

example-generate-md-action-inputs.yml

yaml
name: generate-md-action-inputs example
on:
  workflow_dispatch:
permissions:
  actions: write
  contents: write
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - uses: stephansama/actions/generate-md-action-inputs@v1
        with:
          verbose: true

Required permissions

yaml
permissions:
  actions: write
  contents: write

⚙️ Inputs

NameDefaultDescriptionRequired
comment_tag_nameACTIONPrefix for delimiting block start and endfalse
commit_messageUpdated readme with the latest action inputsCommit message used while committing to the repofalse
committer_usernamestephansama-botUsername used while committing to the repofalse
committer_emailstephansama-bot@example.comEmail id used while committing to the repofalse
gh_token${{github.token}}Github token scoped to current repo (need to have an environment variable set if not supplied)false
git_providergithubGit Provider to base remote urls from. Supported values are 'github' and 'gitlab'.false
heading⚙️ InputsHeading for tablefalse
heading_level3Heading level for tablefalse
skip_commitfalseSkips committing the changes to repofalse
verbosefalseWhether or not to enable verbose logging for shell scriptsfalse

Type Aliases

Type AliasDescription

ActionData

ActionType

BuiltCommentTags

GitProvider

Inputs

TableHeading

Functions

FunctionDescription

buildCommentTags

capitalize

commitReadmes

createHeading

createTable

debugCommit

findIndices

getActionsPaths

getGitRoot

isValidActionData

loadActionData

loadInputs

run

setupGit

updateLocalActionReadmes

writeActionsData

Released under MIT license