Skip to content

generate-md-action-inputs

yaml

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.

  • 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:

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

After:

<!-- ACTION start -->
| Name | Default | Description | Required |
| ---------- | --------------- | ------------------------- | -------- |
| `my-input` | `default-value` | This is my amazing input. | `false` |
<!-- ACTION end -->
  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:

    <!-- 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

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
permissions:
actions: write
contents: write
🏷️ NameRequired⚙️ Default📝 Description
comment_tag_namecomment_tag_nameACTIONPrefix for delimiting block start and end
commit_messagecommit_messageUpdated readme with the latest action inputsCommit message used while committing to the repo
committer_usernamecommitter_usernamestephansama-botUsername used while committing to the repo
committer_emailcommitter_email[email protected]Email id used while committing to the repo
gh_tokengh_token${{github.token}}Github token scoped to current repo (need to have an environment variable set if not supplied)
git_providergit_providergithubGit Provider to base remote urls from. Supported values are ‘github’ and ‘gitlab’.
headingheading⚙️ InputsHeading for table
heading_levelheading_level3Heading level for table
skip_commitskip_commitfalseSkips committing the changes to repo
verboseverbosefalseWhether or not to enable verbose logging for shell scripts
Type Alias Description

ActionData

ActionType

BuiltCommentTags

GitProvider

Inputs

TableHeading

Function Description

buildCommentTags

capitalize

commitReadmes

createHeading

createTable

debugCommit

findIndices

getActionsPaths

getGitRoot

isValidActionData

loadActionData

loadInputs

run

setupGit

updateLocalActionReadmes

writeActionsData