π Status: failing | Updated: 2025-08-19 01:11:54 UTC | Run: #6 | Auto-generated
Comprehensive validation action for PowerShell modules featuring security scans, code quality analysis, and automated testing with enterprise-grade reporting.
- π‘οΈ Security Scanning: GitLeaks for secret detection
- π Code Quality: Super-Linter with PSScriptAnalyzer, JSCPD, and more
- π§ͺ Automated Testing: Pester v5 with code coverage
- π Rich Reporting: Detailed GitHub summaries with metrics
- β‘ High Performance: Optimized for CI/CD pipelines
- π§ Configurable: Flexible inputs for various project needs
name: PowerShell Module Validation
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate PowerShell Module
uses: GrexyLoco/K.Actions.PSModuleValidation@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
module-name: 'MyModule'
- name: Validate PowerShell Module
uses: GrexyLoco/K.Actions.PSModuleValidation@v1
with:
test-path: './Tests'
output-path: './TestResults.xml'
validate-all-codebase: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
module-name: 'MyAdvancedModule'
pester-configuration: |
{
"Run": {
"Path": "./Tests",
"PassThru": true
},
"Output": {
"Verbosity": "Detailed"
},
"TestResult": {
"Enabled": true,
"OutputPath": "./TestResults.xml",
"OutputFormat": "NUnitXml"
},
"CodeCoverage": {
"Enabled": true,
"OutputFormat": "JaCoCo",
"Path": ["*.ps1", "*.psm1"],
"Threshold": 80
}
}
Input | Description | Required | Default |
---|---|---|---|
test-path |
Path to the test directory containing Pester tests. If empty, auto-discovery will search for test files up to 5 levels deep. | No | '' (auto-discovery) |
output-path |
Path for test results XML output | No | ./TestResults.xml |
validate-all-codebase |
Whether to validate all codebase or only changed files | No | false |
github-token |
GitHub token for Super-Linter | Yes | - |
pester-configuration |
Custom Pester configuration (JSON format) | No | Default config |
module-name |
Name of the PowerShell module (for reporting) | No | PowerShell Module |
Output | Description |
---|---|
test-success |
Whether all tests passed successfully |
total-tests |
Total number of tests executed |
passed-tests |
Number of tests that passed |
failed-tests |
Number of tests that failed |
skipped-tests |
Number of tests that were skipped |
test-duration |
Total test execution duration (seconds) |
test-results-path |
Path to the test results XML file |
coverage-percentage |
Code coverage percentage |
- Secret Detection: Scans for exposed API keys, credentials, and sensitive data
- Pattern Matching: 100+ built-in patterns for common secrets
- Zero False Positives: Tuned for PowerShell module development
- π API Keys (AWS, Google, GitHub, Azure, etc.)
- π Private Keys (RSA, SSH, PGP)
- π§ Email addresses in code
- π URLs with embedded credentials
- π³ Credit card numbers
- ποΈ Database connection strings
- PowerShell: PSScriptAnalyzer with best practices
- JSCPD: Copy-paste detection and code duplication analysis
- Markdown: Documentation formatting validation
- YAML/JSON: Configuration file validation
- β PowerShell best practices (PSScriptAnalyzer)
- β Code formatting consistency
- β Documentation standards
- β Configuration file integrity
- β Duplication detection (JSCPD)
- Modern Testing: Latest Pester framework with enhanced features
- Code Coverage: Built-in coverage analysis with configurable thresholds
- Flexible Configuration: JSON-based configuration support
- Artifact Upload: Test results automatically uploaded as artifacts
- Auto-Discovery: If no test path is specified, the action will recursively search up to 5 levels deep for folders named
Test
orTests
. - Strict File Pattern: Only files ending with
.Test.ps1
or.Tests.ps1
inside these folders are considered valid Pester tests. - Warning for Missing Tests: If a test folder exists but no valid test files are found, a warning is issued (not an error).
- Error Only When: Tests exist but fail to pass.
YourModule/
βββ Tests/
β βββ MyFeature.Tests.ps1
β βββ AnotherFeature.Test.ps1
βββ ...
- π Comprehensive test metrics
- π Code coverage analysis
- β‘ Performance monitoring
- π― Quality gate validation
β οΈ Warning for missing tests (not error)
- GitHub Actions Runner: Ubuntu Latest (recommended)
- PowerShell: 5.1+ (automatically available on Ubuntu runners)
- Pester: v5.0+ (automatically installed if missing)
- Test Structure: Tests should be in a dedicated directory
Your PowerShell module should follow this structure:
YourModule/
βββ YourModule.psd1 # Module manifest
βββ YourModule.psm1 # Module file
βββ Tests/ # Test directory
β βββ YourModule.Tests.ps1 # Pester tests
β βββ ...
βββ .github/
β βββ workflows/
β βββ validate.yml # This action
βββ README.md
- name: Validate Module
id: validate
uses: GrexyLoco/K.Actions.PSModuleValidation@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
module-name: 'MyModule'
- name: Check Results
if: always()
run: |
echo "Tests passed: ${{ steps.validate.outputs.test-success }}"
echo "Total tests: ${{ steps.validate.outputs.total-tests }}"
echo "Coverage: ${{ steps.validate.outputs.coverage-percentage }}%"
echo "Duration: ${{ steps.validate.outputs.test-duration }}s"
- name: Deploy to PowerShell Gallery
if: steps.validate.outputs.test-success == 'true' && steps.validate.outputs.coverage-percentage >= '80'
run: |
# Deployment logic here
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This action follows Semantic Versioning with automated releases using K.Actions.NextActionVersion.
- Conventional Commits: Use
feat:
,fix:
,BREAKING CHANGE:
for automatic version bumps - Git Tag-Based: Versions are calculated from Git history, not manifest files
- Smart Detection: Only creates releases when changes warrant a version bump
- Branch Patterns:
feature/
β minor,bugfix/
β patch,major/
β major
See the releases page for all versions, or reference the tags.
- Bug Reports: GitHub Issues
- Feature Requests: GitHub Discussions
- Documentation: This README and inline code comments
- Pester - PowerShell testing framework
- PSScriptAnalyzer - PowerShell code analysis
- GitLeaks - Secret detection
- Super-Linter - Multi-language linter