DEV Community

reakaleek
reakaleek

Posted on

The GitHub Actions Documentation Problem: Managing Multiple Actions (And How to Fix It)

The Problem with GitHub Actions Documentation

Imagine this: You have a monorepo with 15 different GitHub Actions. Each action has an action.yml file with inputs, outputs, and descriptions. Each action also needs a README with usage examples and documentation.

Every time you change an action, you must:

  1. Update the action.yml file
  2. Update the README.md file by hand
  3. Do this for all 15 actions
  4. Hope you don't forget any
  5. Hope your team members do the same

This happens when you:

  • Add new inputs or outputs
  • Change input names or descriptions
  • Make inputs required or optional
  • Update default values
  • Rename the action

This is hard. This is the documentation problem that happens in GitHub Actions repositories, especially monorepos.

Why Monorepos Are Hard

Monorepos with many GitHub Actions are difficult because:

  • Too many actions: 5, 10, or 20+ actions to keep updated
  • Many developers: Different people work on different actions
  • Same format: All documentation must look the same
  • Changes happen fast: Actions change but documentation doesn't

The result? Old documentation that confuses users and wastes time.

The Solution: gh-action-readme

gh-action-readme is a GitHub CLI tool that fixes this problem. The best part? It works with monorepos.

The --recursive Flag

The key feature is the --recursive flag. With one command:

gh action-readme update --recursive
Enter fullscreen mode Exit fullscreen mode

This does everything:

  • Finds all action.yml files in your repository
  • Updates all READMEs
  • Keeps your custom content
  • Works with nested folders

Example Monorepo

Here's what a typical monorepo looks like:

my-actions-monorepo/
├── docker/
│   ├── build-action/
│   │   ├── action.yml
│   │   └── README.md
│   └── push-action/
│       ├── action.yml
│       └── README.md
└── kubernetes/
    ├── deploy-action/
    │   ├── action.yml
    │   └── README.md
    └── rollback-action/
        ├── action.yml
        └── README.md
Enter fullscreen mode Exit fullscreen mode

With gh-action-readme, you can manage all actions easily:

# Create READMEs for all actions
gh action-readme init --recursive

# Update all documentation
gh action-readme update --recursive

# Check if documentation is up-to-date
gh action-readme diff --recursive
Enter fullscreen mode Exit fullscreen mode

How Placeholders Work

The smart part is the placeholder system. Instead of creating whole READMEs, gh-action-readme uses special HTML comments that you control:

# <!--name--><!--/name-->
<!--description-->

## Inputs
<!--inputs-->

## Outputs
<!--outputs-->

## Usage
<!--usage action="org/repo" version="v1.0.0"-->
```yaml
steps:
  - uses: org/repo@v1.0.0
    with:
      input: value
```
<!--/usage-->
Enter fullscreen mode Exit fullscreen mode

This gives you the best of both:

  • Auto-updated parts: Inputs, outputs, descriptions stay current
  • Your content: You control everything else
  • Version updates: Usage examples update automatically

Easy Workflows for Monorepos

1. Auto-update on Commit

Add this to .pre-commit-config.yaml:

repos:
  - repo: https://github.com/reakaleek/gh-action-readme
    rev: v0.5.0
    hooks:
      - id: action-readme
Enter fullscreen mode Exit fullscreen mode

Now every commit updates all documentation. No more forgotten READMEs.

2. Check Documentation in CI

name: pre-commit
on:
  pull_request:

jobs:
  check-docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-python@v6
      - uses: pre-commit/action@v3.0.1
Enter fullscreen mode Exit fullscreen mode

This stops PRs when documentation is wrong. The pre-commit/action automatically runs your pre-commit hooks in CI.

3. Common Commands

# Create READMEs for all actions
gh action-readme init --recursive

# Update all documentation
gh action-readme update --recursive

# Check which actions need updates
gh action-readme diff --recursive
Enter fullscreen mode Exit fullscreen mode

Get Started in 5 Minutes

  1. Install the tool:
   gh extension install reakaleek/gh-action-readme
Enter fullscreen mode Exit fullscreen mode
  1. Create READMEs for all actions:
   gh action-readme init --recursive
Enter fullscreen mode Exit fullscreen mode
  1. Set up auto-updates:
   # Add to .pre-commit-config.yaml
   repos:
     - repo: https://github.com/reakaleek/gh-action-readme
       rev: v0.5.0
       hooks:
         - id: action-readme
Enter fullscreen mode Exit fullscreen mode
  1. Update all documentation:
   gh action-readme update --recursive
Enter fullscreen mode Exit fullscreen mode

Done! Your monorepo documentation is now automatic.

Conclusion

The monorepo documentation problem is real. It takes time every week to keep documentation current. gh-action-readme helps fix this problem.

With monorepo support, automatic workflows, and easy setup, gh-action-readme makes documentation easier. Your team can focus on building actions while the documentation stays up-to-date.


Ready to fix your action documentation?

Get started in 5 minutes: Install gh-action-readme and make monorepo documentation easy.

Top comments (0)