GitHub Actions Workflows Documentation¶
Version: 1.0.0 Last Updated: January 2025 Status: Active
📋 Overview¶
This document provides comprehensive documentation for all GitHub Actions workflows in the standards repository. These workflows automate compliance checking, validation, and maintenance tasks.
🚀 Workflow Details¶
1. Standards Compliance (standards-compliance.yml
)¶
Purpose: Validates that all code and documentation adheres to the defined standards.
Triggers:
- Push to any branch
- Pull request to main/master
- Manual dispatch
Key Steps:
- Checkout code
- Set up Python environment
- Run standards linter (
lint/standards-linter.py
) - Check cross-references
- Validate metadata consistency
- Report compliance score
Failure Conditions:
- Missing required metadata in standards files
- Broken cross-references
- Non-compliant code formatting
- Missing implementation sections
2. NIST Compliance (nist-compliance.yml
)¶
Purpose: Checks NIST 800-53r5 control coverage and validates control tagging.
Triggers:
- Push to branches with security-related changes
- Pull request affecting security code
- Manual dispatch
Key Steps:
- Parse code for @nist annotations
- Validate control IDs against NIST catalog
- Check control implementation completeness
- Generate coverage report
- Update compliance dashboard
Outputs:
- Control coverage percentage
- Missing controls report
- Evidence inventory
- SSP update recommendations
3. Standards Validation (standards-validation.yml
)¶
Purpose: Runs comprehensive validation tests on the standards framework.
Triggers:
- Push to main branch
- Pull request
- Daily schedule (2 AM UTC)
Key Steps:
- Run knowledge management validation
- Check token efficiency
- Validate MANIFEST.yaml
- Test loading patterns
- Verify examples compile
Test Suite:
tests/validate_knowledge_management.sh
tests/validate_cross_references.py
tests/validate_token_efficiency.py
4. Redundancy Check (redundancy-check.yml
)¶
Purpose: Detects code duplication and ensures DRY principles.
Triggers:
- Pull request
- Weekly schedule (Mondays)
Key Steps:
- Run
test_redundancy.py
- Analyze for duplicate code blocks
- Check for repeated documentation
- Generate redundancy report
- Suggest consolidation opportunities
Thresholds:
- Fail if >10% redundancy in any file
- Warn if >5% redundancy across files
5. Auto-Fix Whitespace (auto-fix-whitespace.yml
)¶
Purpose: Automatically removes trailing whitespace and fixes line endings.
Triggers:
- Push to any branch (if enabled)
- Manual dispatch
Key Steps:
- Run
fix_trailing_whitespace.sh
- Check for changes
- Commit fixes if found
- Push to branch
Configuration:
- Can be disabled via
.github/no-auto-fix
file - Respects
.gitignore
patterns - Preserves intentional whitespace in code blocks
6. Auto Summaries (auto-summaries.yml
)¶
Purpose: Generates periodic summaries and reports.
Triggers:
- Weekly schedule (Sundays at midnight UTC)
- Monthly on the 1st
- Manual dispatch
Key Steps:
- Analyze recent changes
- Generate compliance trends
- Create usage statistics
- Update dashboard metrics
- Post summary to discussions/wiki
Reports Generated:
- Weekly compliance summary
- Monthly standards adoption metrics
- Quarterly trend analysis
🔧 Configuration¶
Environment Variables¶
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NIST_API_KEY: ${{ secrets.NIST_API_KEY }} # Optional
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} # For notifications
Workflow Permissions¶
All workflows require:
contents: read
- Read repositorycontents: write
- For auto-fix workflowspull-requests: write
- For PR commentsissues: write
- For creating issues
📊 Workflow Matrix¶
Workflow | PR Required | Auto-Fix | Blocking | Schedule |
---|---|---|---|---|
Standards Compliance | ✅ | ❌ | ✅ | ❌ |
NIST Compliance | ✅ | ❌ | ✅ | ❌ |
Standards Validation | ✅ | ❌ | ✅ | Daily |
Redundancy Check | ✅ | ❌ | ⚠️ | Weekly |
Auto-Fix Whitespace | ❌ | ✅ | ❌ | ❌ |
Auto Summaries | ❌ | ❌ | ❌ | Weekly |
🚨 Troubleshooting¶
Common Issues¶
- Workflow not triggering
- Check branch protection rules
- Verify workflow file syntax
-
Ensure proper permissions
-
Tests failing intermittently
- Check for race conditions
- Verify external dependencies
-
Review timeout settings
-
Auto-fix creating loops
- Add
[skip ci]
to commit messages - Configure branch exclusions
- Set maximum retry limits
Debug Mode¶
Enable debug logging:
🔗 Integration¶
With Pre-commit Hooks¶
Workflows complement local pre-commit hooks:
# Local validation
pre-commit run --all-files
# Same checks run in CI
.github/workflows/standards-compliance.yml
With VS Code Extension¶
The NIST compliance workflow uses the same parser as the VS Code extension for consistency.
With Compliance Platform¶
Workflows can trigger compliance platform actions:
📈 Metrics and Monitoring¶
Track workflow performance:
- Average runtime per workflow
- Success/failure rates
- Most common failure reasons
- Time to fix after failure
Access metrics:
- GitHub Actions tab
- Workflow run history
- API:
GET /repos/{owner}/{repo}/actions/runs
🔐 Security Considerations¶
- Secrets Management
- Use GitHub Secrets for sensitive data
- Rotate keys regularly
-
Limit secret access by environment
-
Third-party Actions
- Pin to specific versions
- Review action code
-
Use official actions when possible
-
Permissions
- Use least privilege principle
- Scope permissions per job
- Audit workflow permissions regularly
🎯 Best Practices¶
- Keep workflows focused - One purpose per workflow
- Use caching - Cache dependencies for faster runs
- Fail fast - Exit early on critical failures
- Provide context - Clear error messages and fix suggestions
- Monitor costs - Track Actions minutes usage
📚 Related Documentation¶
- GitHub Actions Documentation
- CONTRIBUTING.md - How workflows affect contributions
- tests/README.md - Test suite documentation
- .github/workflows/ - Workflow source files directory