1.8.0 ā€¢ Published 6 months ago

github-action-readme-generator v1.8.0

Weekly downloads
-
License
APACHE
Repository
github
Last release
6 months ago

GitHub Action: GitHub Action's Readme Generator

šŸ““ Keep your action's README.md up to date with the title and description from the action.yml file, while also automatically generating sections for the inputs, outputs, and a usage example for the action. Additionally the Action's usage example is updated to match the Action's current release. This is both a CLI tool and GitHub Action that will read the details from a GitHub Action's action.yml file. Configuration can be provided through a .ghadocs.json file stored in the root directory of the Action's repository, via the command line when using the CLI, or through the with: section of this Action. HOW šŸ“ This tool uses markdown comments like this <!-- start section --><!-- stop section --> as delimiting tokens within your README.md file to determine where to place the generated content. You can find an example README template with all fields filled-in in the README.example.md file.***

CLI Usage

Usage OptionsDescriptionDefault
--helpShow helpboolean
--paths:action, --actionPath to the action.ymldefault: ""
--paths:readme, --readmePath to the README.mddefault: ""
--show_logo, --logoDisplay the action's logo in the READMEdefault: false
--prettier, --prettyFormat the markdown using prettier formatterdefault: false
--versioning:enabled, --versioningEnable the update of the usage version to match the latest version in the package.json filedefault: false
--versioning:override, --versionShow version numberbooleandefault: ""
--versioning:prefix, --vpPrefix the version with this value (if it isn't already prefixed)default: ""
--versioning:branch, --branchIf versioning is disabled show this branch insteaddefault: ""
--title_prefix, --prefixAdd a prefix to the README titledefault: ""

Stand Alone Usage - if you have a Docker Action

npx --yes github-action-readme-generator@latest

Install with Yarn or NPM as a dev dependency

yarn add -D github-action-readme-generator
# or
npm i --save-dev github-action-readme-generator

Add a script to your project file

You can modify the script below to include any extra variables you like or use none, and instead use a .ghadocs.json file.

{
  "scripts": {
    "ghadocs": "github-action-readme-generator --readme README.md && git add README.md"
  }
}

Configuration

Example .ghadocs.json with all possible values

{
  "paths": {
    "action": "action.yml",
    "readme": "README.md"
  },
  "show_logo": true,
  "versioning": {
    "enabled": true,
    "override": "",
    "prefix": "v",
    "branch": "main"
  },
  "owner": "bitflight-devops",
  "repo": "github-action-readme-generator",
  "title_prefix": "GitHub Action: ",
  "prettier": true
}

Usage

- uses: bitflight-devops/github-action-readme-generator@v1.7.2
  with:
    # Description: The absolute or relative path to the `action.yml` file to read in
    # from.
    #
    # Default: action.yml
    action: ""

    # Description: The absolute or relative path to the markdown output file that
    # contains the formatting tokens within it.
    #
    # Default: README.md
    readme: ""

    # Description: The GitHub Action repository owner, this field is autodetected by
    # default. Example: `bitflight-devops` or `your-gh-username`
    #
    owner: ""

    # Description: The GitHub Action repository name, this field is autodetected by
    # default. Example: `github-action-readme-generator`
    #
    repo: ""

    # Description: Save the provided values in a `.ghadocs.json` file. This will
    # update any existing `.ghadocs.json` file that is in place.
    #
    # Default: false
    save: ""

    # Description: Use `prettier` to pretty print the new README.md file
    #
    # Default: true
    pretty: ""

    # Description: Enable the update of the usage version to match the latest version
    # in the `package.json` file Output if your action repo is
    # `reviewdog/action-eslint` and version in package.json is `1.0.1`:
    # `uses: reviewdog/action-eslint@1.0.1`
    #
    # Default: true
    versioning_enabled: ""

    # Description: Set a specific version to display in the README.md, maybe you want
    # to use a major or minor version
    #
    version_override: ""

    # Description: Prefix the version with this value, if it isn't already prefixed
    #
    # Default: v
    version_prefix: ""

    # Description: If versioning is disabled, use this branch in the usage example,
    # where the default is `main` Output if your action repo is
    # `reviewdog/action-eslint`: `uses: reviewdog/action-eslint@main`
    #
    # Default: main
    versioning_default_branch: ""

    # Description: Add a prefix to the README title. The title template looks like
    # this:
    #
    # # {brand}{prefix}{title}
    #
    # Default: GitHub Action:
    title_prefix: ""

    # Description: Include additional badge showing latest tag
    #
    # Default: true
    include_github_version_badge: ""

    # Description: Create the branding svg image from the branding object in
    # `action.yml` then save it to this path. Then update the `README.md` file to
    # source the branding image from this path. You can use a section template like
    # this: `<!-- start branding --><!-- stop branding -->` or use the action input:
    # `branding_as_title_prefix: true` to prefix the 'title' section with the image.
    # The title template looks like this:
    #
    # # {brand}{prefix}{title}
    #
    # Default: .github/ghadocs/branding.svg
    branding_svg_path: ""

    # Description: Prefix the title in the `<!-- start title -->` section with the svg
    # branding image The title template looks like this:
    #
    # # {brand}{prefix}{title}
    #
    # Default: true
    branding_as_title_prefix: ""

Inputs

InputDescriptionDefaultRequired
actionThe absolute or relative path to the action.yml file to read in from.action.ymlfalse
readmeThe absolute or relative path to the markdown output file that contains the formatting tokens within it.README.mdfalse
ownerThe GitHub Action repository owner, this field is autodetected by default.Example: bitflight-devops or your-gh-usernamefalse
repoThe GitHub Action repository name, this field is autodetected by default.Example: github-action-readme-generatorfalse
saveSave the provided values in a .ghadocs.json file.This will update any existing .ghadocs.json file that is in place.false
prettyUse prettier to pretty print the new README.md filetruefalse
versioning_enabledEnable the update of the usage version to match the latest version in the package.json fileOutput if your action repo is reviewdog/action-eslint and version in package.json is 1.0.1:uses: reviewdog/action-eslint@1.0.1truefalse
version_overrideSet a specific version to display in the README.md, maybe you want to use a major or minor versionfalse
version_prefixPrefix the version with this value, if it isn't already prefixedvfalse
versioning_default_branchIf versioning is disabled, use this branch in the usage example, where the default is mainOutput if your action repo is reviewdog/action-eslint:uses: reviewdog/action-eslint@mainmainfalse
title_prefixAdd a prefix to the README title.The title template looks like this:# {brand}{prefix}{title}GitHub Action: false
include_github_version_badgeInclude additional badge showing latest tagtruefalse
branding_svg_pathCreate the branding svg image from the branding object in action.ymlthen save it to this path.Then update the README.md file to source the branding image from this path.You can use a section template like this:\\or use the action input:branding_as_title_prefix: trueto prefix the 'title' section with the image.The title template looks like this:# {brand}{prefix}{title}.github/ghadocs/branding.svgfalse
branding_as_title_prefixPrefix the title in the \ section with the svg branding imageThe title template looks like this:# {brand}{prefix}{title}truefalse
OutputDescription
sectionsA json object containing a map of section names to their new content
readmeThe path to the generated README.md file
readme_beforeThe content of the readme file before the changes were made
readme_afterThe content of the readme file after the changes were made
1.7.2

7 months ago

1.8.0

6 months ago

1.7.1

7 months ago

1.7.0

7 months ago

1.6.0

7 months ago

1.5.1

7 months ago

1.2.0

2 years ago

1.1.9

2 years ago

1.2.7

2 years ago

1.1.8

2 years ago

1.2.6

2 years ago

1.1.7

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.10

2 years ago

1.0.13

2 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago