Repository navigation
docs: document published pre-commit hook #746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,33 +154,24 @@ You can modify the script below to include any extra variables you like or use n | |
|
|
||
| ### Using as a Pre-commit Hook | ||
|
|
||
| You can automate README generation on every commit by using this tool as a pre-commit hook. This ensures your documentation stays up-to-date automatically. | ||
| This repository publishes a pre-commit hook. The consuming environment needs Node.js and npm/npx compatible with this package's supported Node range. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Specify the supported Node.js and npm versions.
🤖 Prompt for AI Agents |
||
|
|
||
| 1. **Install the tool locally** (if you haven't already): | ||
|
|
||
| ```sh | ||
| npm install --save-dev github-action-readme-generator | ||
| # or | ||
| yarn add -D github-action-readme-generator | ||
| ``` | ||
|
|
||
| 2. **Configure pre-commit**: | ||
|
|
||
| Add the following to your `.pre-commit-config.yaml` file: | ||
| Add it to your `.pre-commit-config.yaml`: | ||
|
|
||
| ```yaml | ||
| repos: | ||
| - repo: local | ||
| - repo: https://github.com/bitflight-devops/github-action-readme-generator | ||
| rev: v2.1.0 | ||
| hooks: | ||
| - id: github-action-readme-generator | ||
| name: Generate README from action.yml | ||
| entry: npx github-action-readme-generator | ||
| language: system | ||
| files: ^(action\.yml|\.ghadocs\.json)$ | ||
| pass_filenames: false | ||
| ``` | ||
|
|
||
| This configuration will automatically regenerate your README whenever `action.yml` or `.ghadocs.json` changes. | ||
| The hook runs on every commit and does not receive staged filenames. Use ordinary pre-commit `args:` to pass generator options such as custom action or README paths: | ||
|
|
||
| ```yaml | ||
| - id: github-action-readme-generator | ||
| args: [--action, path/to/action.yml, --readme, docs/ACTION.md] | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consumers running pre-commit below 4.4.0, this setup cannot run:
.pre-commit-hooks.yaml:6declaresminimum_pre_commit_version: 4.4.0, which the pre-commit documentation defines as the minimum compatible version. The requirements sentence mentions Node/npm but omits this prerequisite, so users with older installations will follow the example and receive a version or manifest error before the generator starts; document that pre-commit >=4.4.0 is also required.AGENTS.md reference: AGENTS.md:L7-L7
Useful? React with 👍 / 👎.