Simple GitHub Actions workflows for automating API documentation generation from source repositories to a docs repository.
This system uses two types of workflows:
- Source Trigger (in your source repo) - Detects changes and triggers docs generation
- Docs Receiver (in your docs repo) - Generates and commits documentation
Source Repo Push/Tag → Trigger Workflow → Docs Repo Workflow → Generate & Commit Docs
Choose the appropriate receiver template:
template-docs-receiver-non-versioned.yml- For non-versioned docs (e.g.,/api)template-docs-receiver-versioned.yml- For versioned docs (e.g.,/5.x/api)
Copy to your docs repo at .github/workflows/generate-api-docs-{CONTRACT}.yml
Configure:
SOURCE_REPO: Owner/repo name (e.g.,OpenZeppelin/openzeppelin-contracts)SOURCE_REPO_URL: Full git URLBASE_OUTPUT_PATH: Docs output path (e.g.,content/contracts)USE_VERSIONED_PATHS:trueorfalse
Choose your trigger type:
template-source-trigger-tag-based.yml- Triggers on git tags (e.g.,release-v5.5)template-source-trigger-commit-based.yml- Triggers on commits to a branch
Copy to your source repo at .github/workflows/trigger-docs-generation.yml
Configure:
WORKFLOW_NAME: Name of the docs workflow (without.yml)- Tag pattern or branch name (depending on template)
In your source repository settings, add:
- Secret name:
DOCS_REPO_TOKEN - Value: GitHub Personal Access Token with
repoandworkflowpermissions
Source repo (contracts):
- Push tag
release-v5.5 - Trigger workflow runs
- Calls docs repo workflow with
tag_name=release-v5.5
Docs repo:
- Receiver workflow runs
- Checks out source at
release-v5.5 - Generates API docs
- Commits to
content/contracts/5.x/api
You can also manually trigger docs generation from the docs repository:
- Go to Actions tab
- Select your workflow
- Click "Run workflow"
- Enter tag name or commit SHA