The workflows subject contains automation scripts that support GitHub Actions workflows, CLI tools, and repository automation. These scripts handle tasks like PR labeling, cache purging, content change analysis, and repository maintenance.
This subject is responsible for:
- PR and issue automation (labeling, metadata, reviewer assignment)
- Cache management (Fastly edge cache purging)
- Content validation and reporting (content type checking, change tables)
- Repository maintenance (orphan file cleanup, syncing)
- Husky git hooks (pre-commit checks)
- GitHub Actions support scripts
Note: This directory does not contain a scripts/ folder since every file here would belong in scripts/. Files are organized flat at the top level with supporting utilities in lib/.
Scripts are registered in package.json:
| Script | Command | Purpose |
|---|---|---|
| content-changes-table-comment | npm run content-changes-table-comment |
Analyzes content changes in PRs |
| check-content-type | npm run check-content-type |
Validates content types |
| delete-orphan-translation-files | npm run delete-orphan-translation-files |
Removes orphaned translations |
| enable-automerge | npm run enable-automerge |
Enables PR automerge |
| purge-fastly-edge-cache | npm run purge-fastly-edge-cache |
Purges Fastly CDN cache |
| prevent-pushes-to-main | (Husky hook) | Prevents pushing to main |
npm run test -- src/workflows/testsMany scripts are called from GitHub Actions workflows in .github/workflows/. They typically:
- Run automatically on PR events, pushes, or schedules
- Use GitHub Actions context (
@actions/github,@actions/core) - Require
GITHUB_TOKENenvironment variable - Post results as PR comments or update PR/issue metadata
- GitHub API: PR data, issue data, file changes, commit history
- Git repository: File contents, frontmatter, diff information
- Environment variables:
GITHUB_TOKEN,FASTLY_TOKEN,BASE_SHA,HEAD_SHA
@actions/github,@actions/core- GitHub Actions SDK@octokit/rest- GitHub API client- Fastly API - For cache purging
- Various internal subjects for content parsing and validation
- PR/issue comments - Content change summaries, validation results
- PR/issue labels - Applied via GitHub API
- Cache purges - Fastly CDN invalidations
- Exit codes - Success/failure for CI/CD
src/frame- Frontmatter reading and path utilitiessrc/versions- Version detection for content changessrc/content-linter- Content validationsrc/git- Git utilities (if exists)- GitHub Actions workflows in
.github/workflows/- Primary consumers
- Team: Docs Engineering
- Some scripts require specific environment variables and can't easily run locally without setup
- Error handling varies across scripts
- Documentation for individual scripts is sometimes inline-only
- Most workflow scripts have limited automated test coverage
- Test locally before deploying to Actions when possible
- Use CLI variants (e.g.,
content-changes-table-comment-cli.ts) for local testing
When adding a new script:
- Create the
.tsfile insrc/workflows/ - Add to
package.jsonscripts if it should be runnable via npm - Document any required environment variables
- Add to
.github/workflows/if it should run automatically - Consider creating a
-cli.tsvariant for local testing - Update this README if the script introduces new patterns
- Standardize error handling and logging across scripts