Instruction file imported from marcelodelima/my-infraops-project (
.github/instructions/github-actions.instructions.md). Copyright stays with the author.
GitHub Actions Workflow Standards
Standards for creating and maintaining CI/CD workflows in this repository. For general GitHub Actions best practices, rely on GitHub Actions documentation.
Project Conventions
Runner and Node.js
- Runner:
ubuntu-latestfor all jobs - Node.js: Version
22withnpmcaching - Dependencies:
npm ci(notnpm install)
Permissions
- Set
permissionsat workflow level (least privilege) - Default:
contents: read - Add write permissions only when needed (e.g.,
issues: writefor freshness checks)
Triggers
- PR validation: Trigger on
pull_requesttomain - Post-merge: Trigger on
pushtomain - Path filters: Use
paths:to scope workflows to relevant files - Manual: Include
workflow_dispatchfor on-demand runs - Scheduled: Use
schedulewith cron for periodic checks (e.g., weekly freshness)
Action Versions
- Pin to major version tags (e.g.,
@v4), not@mainor@latest - Use current versions:
| Action | Version |
|---|---|
actions/checkout |
@v4 |
actions/setup-node |
@v4 |
actions/upload-artifact |
@v4 |
actions/download-artifact |
@v4 |
actions/cache |
@v4 |
Naming and Structure
- Workflow file: Descriptive kebab-case (e.g.,
ci.yml,weekly-maintenance.yml) - Workflow
name: Human-readable title - Job
name: Clear, concise label - Step
name: Descriptive action (e.g., "Validate agent frontmatter") - Start with a comment block describing purpose and trigger conditions
Concurrency
Use concurrency to prevent duplicate runs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Existing Workflows
| Workflow | Purpose | Trigger |
|---|---|---|
ci.yml |
Required PR check: lint + all Node.js validators | PR + push to main/feature |
link-check.yml |
Broken link detection in docs/ | Changes to docs/ + weekly |
docs.yml |
MkDocs site deployment to Pages | Push to main (docs/) |
weekly-maintenance.yml |
AVM version audit + docs freshness checks | Weekly (Mon 07:00) + manual |
azure-deprecation-tracker.yml |
Azure deprecation monitoring | Weekly (Mon 06:00) + manual |
Validation Scripts
Workflows run these project validators:
| Script | Purpose |
|---|---|
validate-artifact-templates.mjs |
Artifact H2 heading compliance |
validate-agent-frontmatter.mjs |
Agent YAML frontmatter validation |
validate-skills-format.mjs |
Skill format validation |
validate-no-deprecated-refs.mjs |
Deprecated reference detection |
validate-vscode-config.mjs |
VS Code configuration validation |
check-docs-freshness.mjs |
Documentation freshness checks |
Security
- Use OIDC for Azure authentication (no long-lived secrets)
- Use
permissions: contents: readas the default - Enable Dependabot for action version updates
- Never print secrets or tokens in workflow logs
Patterns to Avoid
| Anti-Pattern | Solution |
|---|---|
Pinning to @main or @latest |
Use @v4 major version tags |
npm install in CI |
Use npm ci for deterministic installs |
Missing permissions block |
Always declare least-privilege permissions |
| Broad triggers (no path filter) | Scope with paths: to relevant files |
| Duplicate validation logic | Reuse existing validator scripts |
actions/upload-artifact@v3 |
Use @v4 (v3 is deprecated) |