- Notifications
You must be signed in to change notification settings - Fork1k
docs: unify documentation workflows with improved validation#17523
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Uh oh!
There was an error while loading.Please reload this page.
Closed
Changes fromall commits
Commits
Show all changes
9 commits Select commitHold shift + click to select a range
ef93173
refactor: implement docs workflow with MegaLinter and standardized ac…
EdwardAngert83b45fc
fix: correct variable syntax in workflow YAML
EdwardAngert4142800
fix: resolve YAML syntax issues and add Vale configuration
EdwardAngertae27582
style: improve YAML formatting in docs workflow
EdwardAngertb2ffe85
fix: add Node.js setup to docs-unified workflow
EdwardAngert6b714ec
fix: secure GitHub Actions workflow to pass actionlint
EdwardAngert6eb9c32
feat: enhance PR comments with timestamps and progress updates
EdwardAngertae66052
fix: use platform-compatible date formatting in workflow
EdwardAngert36e6ef0
feat: simplify PR comment system in docs workflow
EdwardAngertFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
273 changes: 273 additions & 0 deletions.github/docs/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,273 @@ | ||
# Coder Documentation Workflow | ||
This directory contains GitHub Actions, configurations, and workflows for Coder's unified documentation validation system. | ||
## Developer Quick Start Guide | ||
```bash | ||
# Check only changed documentation files (default behavior) | ||
make lint/docs | ||
# Check ALL documentation files | ||
make lint/docs --all | ||
# Format markdown tables and fix common issues | ||
make fmt/markdown | ||
# Run Vale style check (optional, requires Vale installation) | ||
make lint/docs-style | ||
``` | ||
The validation system will automatically detect and check only files that have changed in your working directory. This ensures fast feedback during development. | ||
## Directory Structure | ||
- `config`: Configuration files for markdown tools (markdownlint, markdown-link-check) | ||
- `vale`: Configuration and style rules for Vale documentation linting | ||
- `testing`: Test scripts and utilities for workflow validation | ||
## Quick Start | ||
For developers working with documentation, here are the most commonly used commands: | ||
```bash | ||
# Run comprehensive documentation validation (markdown lint + link checking) | ||
make lint/docs | ||
# Run only markdown linting | ||
make lint/markdown | ||
# Run optional style checking with Vale (if installed) | ||
make lint/docs-style | ||
# Fix formatting issues | ||
make fmt/markdown # Formats tables and markdown styling | ||
``` | ||
## Local vs CI Validation | ||
The validation that runs in CI is available locally through the same Makefile targets: | ||
| GitHub Action | Local Command | Description | | ||
|---------------|--------------|-------------| | ||
| Markdown linting | `make lint/markdown` | Checks markdown formatting | | ||
| Link checking | `make lint/docs` | Verifies links aren't broken | | ||
| Vale style checking | `make lint/docs-style` (optional) | Validates documentation style with Vale | | ||
| Cross-reference validation | *Part of CI only* | Checks references between docs | | ||
### Optional Tool Installation | ||
While basic linting works out-of-the-box with node dependencies, additional tools can be installed for more advanced checks: | ||
```bash | ||
# Install Lychee for link checking (recommended) | ||
cargo install lychee | ||
# Install Vale for style checking (optional) | ||
brew install vale | ||
# Node dependencies for markdown formatting (required) | ||
pnpm install | ||
``` | ||
# Coder Documentation Workflow System | ||
## Workflow Architecture | ||
The documentation workflow system uses MegaLinter and standardized GitHub Actions to provide a comprehensive validation pipeline: | ||
``` | ||
┌─ Workflow Entry Points ───────────────────────────────────────────────────────┐ | ||
│ │ | ||
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌───────────┐ │ | ||
│ │ PR Preview │ │ Post-Merge │ │ Weekly │ │ CI Check │ │ | ||
│ │ Workflow │ │ Validation │ │ Checks │ │ Workflow │ │ | ||
│ │ docs-preview.yml│ │ docs-ci.yml │ │weekly-docs.yml │ │docs-ci.yml│ │ | ||
│ │ │ │ │ │ │ │ │ │ | ||
│ │ • Runs on PR │ │ • Runs after │ │ • Runs weekly │ │ • Runs on │ │ | ||
│ │ creation/update│ │ merges to main│ │ on schedule │ │ PR │ │ | ||
│ │ • Generates │ │ • Checks links │ │ • Comprehensive │ │ • Basic │ │ | ||
│ │ preview links │ │ only │ │ validation │ │ checks │ │ | ||
│ │ • Validates docs│ │ • Falls back to │ │ • Planned: issues│ │ • Fast │ │ | ||
│ │ • Posts comments│ │ original doc │ │ for problems │ │ feedback│ │ | ||
│ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ └─────┬─────┘ │ | ||
│ │ │ │ │ │ | ||
└───────────┼────────────────────┼────────────────────┼──────────────────┼───────┘ | ||
│ │ │ │ | ||
└──────────┬─────────┴──────────┬─────────┴──────────┬──────┘ | ||
│ │ │ | ||
▼ ▼ ▼ | ||
┌─ Unified Reusable Workflow ─────────────────────────────────────────────────────┐ | ||
│ │ | ||
│ docs-unified.yaml │ | ||
│ ┌───────────────────────────────────────────────────────────────────────────┐ │ | ||
│ │ Configuration System │ │ | ||
│ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │ | ||
│ │ │ PR Preset │ │Post Preset │ │Weekly Preset│ │ CI Preset │ │ │ | ||
│ │ └────────────┘ └────────────┘ └────────────┘ └────────────┘ │ │ | ||
│ └───────────────────────────────────────────────────────────────────────────┘ │ | ||
│ │ | ||
│ ┌───────────────────────────────────────────────────────────────────────────┐ │ | ||
│ │ Validation Pipeline │ │ | ||
│ │ ┌────────────────┐ ┌────────────────┐ ┌────────────────┐ │ │ | ||
│ │ │ MegaLinter │ │ Cross-reference│ │ Result Reporting│ │ │ | ||
│ │ │ Documentation │ │ Validation │ │ and Comments │ │ │ | ||
│ │ └────────────────┘ └────────────────┘ └────────────────┘ │ │ | ||
│ └───────────────────────────────────────────────────────────────────────────┘ │ | ||
│ │ | ||
└─────────────────────────────────────────────────────────────────────────────────┘ | ||
│ | ||
▼ | ||
┌─ Local Development Integration ────────────────────────────────────────────────┐ | ||
│ │ | ||
│ Makefile targets that mirror workflow functionality: │ | ||
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │ | ||
│ │ make lint/docs│ │make fmt/markdown│ │make lint/markdown│ │make lint/docs-style│ │ | ||
│ └───────────────┘ └───────────────┘ └───────────────┘ └───────────────┘ │ | ||
│ │ | ||
``` | ||
## Documentation Workflow Components | ||
### Entry Point Workflows | ||
The system provides four specialized entry points for different validation scenarios: | ||
1. **PR Preview (docs-preview.yaml)** | ||
- Triggers on PR create/update when docs files change | ||
- Performs comprehensive validation on documentation changes | ||
- Generates preview links and posts PR comments with results | ||
- Skips link checking for faster feedback | ||
2. **Post-Merge Validation (docs-link-check.yaml)** | ||
- Runs after merges to main branch | ||
- Lightweight check focused only on link integrity | ||
- Ensures merged content maintains external link validity | ||
3. **Weekly Check (weekly-docs.yaml)** | ||
- Scheduled run every Monday at 9 AM | ||
- Comprehensive validation of documentation health | ||
- Checks links, cross-references, markdown structure, and formatting | ||
- Creates issues for persistent problems | ||
4. **CI Check (docs-ci.yaml)** | ||
- Fast validation for continuous integration | ||
- Focuses on formatting and structural issues | ||
- Designed for rapid feedback | ||
### Unified Workflow & Presets | ||
All entry points use the central `docs-unified.yaml` workflow with different preset configurations: | ||
| Preset | Description | Main Validations | When Used | | ||
|--------|-------------|------------------|-----------| | ||
| `pr` | Complete validation for PRs | markdown, formatting, style, cross-references | PRs that modify docs (preview workflow) | | ||
| `post-merge` | Lightweight check after merge | links | After merging to main (catches broken links) | | ||
| `weekly` | Scheduled health check | markdown, formatting, links, cross-references | Weekly cron job (comprehensive check) | | ||
| `ci` | Fast CI validation | markdown, formatting | PR checks (fast feedback) | | ||
## Key Tools and Integrations | ||
### MegaLinter Documentation Flavor | ||
The workflow leverages MegaLinter's documentation flavor to provide comprehensive validation: | ||
- **markdownlint**: Validates markdown syntax and formatting | ||
- **Vale**: Checks documentation style and terminology | ||
- **markdown-link-check**: Verifies links are valid and accessible | ||
Configuration files are stored in standardized locations: | ||
- `.github/docs/config/.markdownlint.yml`: Markdown linting rules | ||
- `.github/docs/vale/.vale.ini`: Vale style configuration | ||
- `.github/docs/config/markdown-link-check.json`: Link checking settings | ||
### Changed Files Detection | ||
The workflow uses tj-actions/changed-files to efficiently detect changed files: | ||
```yaml | ||
# Get changed files | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v41 | ||
with: | ||
files: | | ||
docs/**/*.md | ||
**/*.md | ||
``` | ||
### Cross-Reference Validation | ||
Custom cross-reference validation checks for broken internal links: | ||
- References to deleted files | ||
- Broken internal markdown links | ||
- Missing image references | ||
## Vale Style Checking | ||
The workflow includes Vale style checking that: | ||
- Only examines changed files to improve performance | ||
- Validates documentation against Coder style guidelines | ||
- Uses the errata-ai/vale-action GitHub Action | ||
- Is configured in `.github/docs/vale/` with custom rules | ||
### Vale Style Rules | ||
The following style rules are configured: | ||
| Rule | Description | Severity | | ||
|------|-------------|----------| | ||
| `Coder.Headings` | Ensures proper heading capitalization | warning | | ||
| `Coder.Terms` | Enforces consistent terminology | warning | | ||
| `Coder.RepeatedWords` | Catches repeated words like "the the" | error | | ||
| `Coder.SentenceLength` | Warns about overly long sentences | suggestion | | ||
| `GitLab.*` | Various rules from GitLab style guide | varies | | ||
To suppress a Vale rule for a specific line: | ||
```markdown | ||
<!-- vale Coder.SentenceLength = NO --> | ||
This is a very long sentence that would normally trigger the sentence length rule but has been explicitly exempted for a good reason such as a technical requirement or quotation. | ||
<!-- vale Coder.SentenceLength = YES --> | ||
``` | ||
## Workflow Configuration Options | ||
Each workflow entry point can be customized with these key parameters: | ||
| Parameter | Description | Default | | ||
|-----------|-------------|---------| | ||
| `preset` | Predefined configuration bundle | (required) | | ||
| `lint-markdown` | Run markdown linting | (from preset) | | ||
| `check-format` | Validate table formatting | (from preset) | | ||
| `check-links` | Verify link integrity | (from preset) | | ||
| `check-cross-references` | Check documentation cross-references | (from preset) | | ||
| `lint-vale` | Run Vale style validation | (from preset) | | ||
| `generate-preview` | Create preview links | (from preset) | | ||
| `post-comment` | Post results as PR comment | (from preset) | | ||
| `create-issues` | Create GitHub issues for failures | (from preset) | | ||
| `fail-on-error` | Fail workflow on validation errors | (from preset) | | ||
## Using Documentation Validation in Custom Workflows | ||
To use documentation validation in your own workflows: | ||
```yaml | ||
jobs: | ||
custom-docs-check: | ||
uses: ./.github/workflows/docs-unified.yaml | ||
with: | ||
preset: 'pr' # Choose a preset based on your needs | ||
# Optional overrides | ||
check-links: false # For faster checks | ||
notification-channels: 'slack' # For notifications | ||
``` | ||
Available presets: | ||
- `pr`: Full validation with PR comments and preview links | ||
- `post-merge`: Lightweight link checking for merged content | ||
- `weekly`: Comprehensive health check for scheduled runs | ||
- `ci`: Fast validation for continuous integration | ||
The presets provide sensible defaults for each use case, which can be overridden as needed for specific scenarios. |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.