microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
scripts/README.md
86lines · modecode
| 1 | --- |
| 2 | title: Scripts |
| 3 | description: PowerShell scripts for linting, validation, and security automation |
| 4 | author: HVE Core Team |
| 5 | ms.date: 2025-11-05 |
| 6 | ms.topic: reference |
| 7 | keywords: |
| 8 | - powershell |
| 9 | - scripts |
| 10 | - automation |
| 11 | - linting |
| 12 | - security |
| 13 | estimated_reading_time: 5 |
| 14 | --- |
| 15 | |
| 16 | This directory contains PowerShell scripts for automating linting, validation, and security checks in the `hve-core` repository. |
| 17 | |
| 18 | ## Directory Structure |
| 19 | |
| 20 | ```text |
| 21 | scripts/ |
| 22 | ├── linting/ PowerShell linting and validation scripts |
| 23 | └── security/ Security scanning and SHA pinning scripts |
| 24 | ``` |
| 25 | |
| 26 | ## Linting Scripts |
| 27 | |
| 28 | The `linting/` directory contains scripts for validating code quality and documentation: |
| 29 | |
| 30 | * **PSScriptAnalyzer**: Static analysis for PowerShell files |
| 31 | * **Markdown Frontmatter**: Validate YAML frontmatter in markdown files |
| 32 | * **Link Language Check**: Detect en-us language paths in URLs |
| 33 | * **Markdown Link Check**: Validate markdown links |
| 34 | * **Shared Module**: Common helper functions for GitHub Actions integration |
| 35 | |
| 36 | See [linting/README.md](linting/README.md) for detailed documentation. |
| 37 | |
| 38 | ## Security Scripts |
| 39 | |
| 40 | The `security/` directory contains scripts for security scanning and dependency management: |
| 41 | |
| 42 | * **Dependency Pinning**: Validate SHA pinning compliance |
| 43 | * **SHA Staleness**: Check for outdated SHA pins |
| 44 | * **SHA Updates**: Automate updating GitHub Actions SHA pins |
| 45 | |
| 46 | ## Usage |
| 47 | |
| 48 | All scripts are designed to run both locally and in GitHub Actions workflows. They support common parameters like `-Verbose` and `-Debug` for troubleshooting. |
| 49 | |
| 50 | **Local Testing**: |
| 51 | |
| 52 | ```powershell |
| 53 | # Test PSScriptAnalyzer on changed files |
| 54 | ./scripts/linting/Invoke-PSScriptAnalyzer.ps1 -ChangedFilesOnly -Verbose |
| 55 | |
| 56 | # Validate markdown frontmatter |
| 57 | ./scripts/linting/Validate-MarkdownFrontmatter.ps1 -Verbose |
| 58 | |
| 59 | # Check for language paths in URLs |
| 60 | ./scripts/linting/Invoke-LinkLanguageCheck.ps1 -Verbose |
| 61 | ``` |
| 62 | |
| 63 | **GitHub Actions Integration**: |
| 64 | |
| 65 | All scripts automatically detect GitHub Actions environment and provide appropriate output formatting (annotations, summaries, artifacts). |
| 66 | |
| 67 | ## Contributing |
| 68 | |
| 69 | When adding new scripts: |
| 70 | |
| 71 | 1. Follow PowerShell best practices (PSScriptAnalyzer compliant) |
| 72 | 2. Support `-Verbose` and `-Debug` parameters |
| 73 | 3. Add GitHub Actions integration using `LintingHelpers` module functions |
| 74 | 4. Include inline help with `.SYNOPSIS`, `.DESCRIPTION`, `.PARAMETER`, and `.EXAMPLE` |
| 75 | 5. Document in relevant README files |
| 76 | 6. Test locally before creating PR |
| 77 | |
| 78 | ## Related Documentation |
| 79 | |
| 80 | * [Linting Scripts Documentation](linting/README.md) |
| 81 | * [GitHub Workflows Documentation](../.github/workflows/README.md) |
| 82 | * [Contributing Guidelines](../CONTRIBUTING.md) |
| 83 | |
| 84 | --- |
| 85 | |
| 86 | 🤖 Crafted with precision by ✨Copilot following brilliant human instruction, then carefully refined by our team of discerning human reviewers. |
| 87 | |