Skip to content

Commit abb7da2

Browse files
Merge pull request #77 from WarehouseFinds/copilot/update-readme-with-new-features
Update README with accurate function names and new feature documentation
2 parents 6ad7582 + 6e80272 commit abb7da2

File tree

1 file changed

+80
-11
lines changed

1 file changed

+80
-11
lines changed

README.md

Lines changed: 80 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This template solves the common challenge of setting up a professional PowerShel
3535
- **Code coverage reporting** (Cobertura format)
3636
- **PSScriptAnalyzer integration** for static code analysis
3737
- **InjectionHunter security scanning** for injection vulnerability detection
38+
- **CodeQL semantic analysis** for advanced security scanning
3839
- **Test results in NUnit XML format** for CI/CD integration
3940

4041
### 📚 Documentation Generation
@@ -54,6 +55,8 @@ This template solves the common challenge of setting up a professional PowerShel
5455
- **Automated quality gates** (tests, analysis, security scans)
5556
- **Automated releases** on PR merges to main
5657
- **PowerShell Gallery publishing** support
58+
- **Automated cleanup workflows** for managing artifacts and workflow runs
59+
- **Manual workflow dispatch** with version control and publishing options
5760

5861
### 📦 Dependency Management
5962
- **PSDepend** for managing module dependencies
@@ -72,19 +75,19 @@ PSScriptModule.Template/
7275
├── 📁 src/ # Source code
7376
│ ├── 📄 PSScriptModule.psd1 # Module manifest
7477
│ ├── 📁 Public/ # Public functions (exported)
75-
│ │ ├── Get-Example.ps1
76-
│ │ └── Get-Example.Tests.ps1
78+
│ │ ├── Get-PSScriptModuleInfo.ps1
79+
│ │ └── Get-PSScriptModuleInfo.Tests.ps1
7780
│ └── 📁 Private/ # Private functions (internal only)
78-
│ ├── HelperFunction.ps1
79-
│ └── HelperFunction.Tests.ps1
81+
│ ├── GetModuleId.ps1
82+
│ └── GetModuleId.Tests.ps1
8083
├── 📁 tests/ # Test suites
8184
│ ├── 📁 PSScriptAnalyzer/ # Static code analysis tests
8285
│ │ ├── PSScriptAnalyzer.Tests.ps1
8386
│ │ └── PSScriptAnalyzerSettings.psd1
8487
│ └── 📁 InjectionHunter/ # Security vulnerability tests
8588
│ └── InjectionHunter.Tests.ps1
8689
├── 📁 docs/help/ # Markdown documentation
87-
│ └── Get-Example.md
90+
│ └── Get-PSScriptModuleInfo.md
8891
└── 📁 build/ # Build output (generated)
8992
├── 📁 src/ # Copied source for building
9093
├── 📁 out/ # Compiled module output
@@ -168,7 +171,7 @@ Invoke-Build Invoke-PSScriptAnalyzer # Code analysis only
168171
Invoke-Build Invoke-InjectionHunter # Security scans only
169172
170173
# Run Pester directly
171-
Invoke-Pester -Path ./src/Public/Get-Example.Tests.ps1
174+
Invoke-Pester -Path ./src/Public/Get-PSScriptModuleInfo.Tests.ps1
172175
173176
# Run with code coverage
174177
Invoke-Pester -Configuration @{
@@ -207,11 +210,43 @@ Help files are generated in two formats:
207210
Import-Module ./build/out/PSScriptModule/PSScriptModule.psd1
208211
209212
# View help
210-
Get-Help Get-Example -Full
211-
Get-Help Get-Example -Examples
212-
Get-Help Get-Example -Online
213+
Get-Help Get-PSScriptModuleInfo -Full
214+
Get-Help Get-PSScriptModuleInfo -Examples
215+
Get-Help Get-PSScriptModuleInfo -Online
213216
```
214217

218+
## 🔄 CI/CD Pipeline
219+
220+
The template includes a comprehensive CI/CD pipeline that runs automatically on pull requests and pushes to main.
221+
222+
### Pipeline Structure
223+
224+
The CI workflow orchestrates multiple jobs in parallel:
225+
226+
1. **Setup** - Caches PowerShell module dependencies for faster builds
227+
2. **Unit Tests** - Runs Pester tests with code coverage reporting
228+
3. **Static Code Analysis** - Validates code with PSScriptAnalyzer rules
229+
4. **Code Injection Analysis** - Scans for injection vulnerabilities with InjectionHunter
230+
5. **Semantic Code Analysis** - Runs CodeQL security analysis
231+
6. **Build** - Compiles module, generates help, creates releases, and publishes to PowerShell Gallery
232+
233+
### Workflow Triggers
234+
235+
- **Pull Request**: Runs all quality gates (tests not run for workflow-only changes)
236+
- **Push to main**: Runs full pipeline and creates prerelease
237+
- **Workflow Dispatch**: Manual trigger with custom version and publish options
238+
- **Schedule**: Weekly CodeQL security scan
239+
240+
### Build Types
241+
242+
The pipeline automatically determines the build type:
243+
244+
| Event | Build Type | Version Format | Published |
245+
|-------|-----------|----------------|-----------|
246+
| Pull Request | Debug | `1.2.3-PullRequest1234` | No |
247+
| Push to main | Prerelease | `1.2.3-Prerelease` | Yes |
248+
| Manual (workflow_dispatch) | Release | `1.2.3` | Optional |
249+
215250
## 🔄 Versioning Strategy
216251

217252
This template uses **Semantic Versioning** (SemVer) with automated version management through GitVersion.
@@ -292,7 +327,7 @@ git commit -m "Update README +semver: none"
292327
3. **Update module manifest** if adding public function:
293328
```powershell
294329
# Add to FunctionsToExport in PSScriptModule.psd1
295-
FunctionsToExport = @('Get-Example', 'Get-Something')
330+
FunctionsToExport = @('Get-PSScriptModuleInfo', 'Get-Something')
296331
```
297332

298333
4. **Build and test**:
@@ -320,10 +355,25 @@ Invoke-Build -ReleaseType Release -NugetApiKey 'YOUR-API-KEY'
320355
### Automated Publishing (CI/CD)
321356

322357
Configure your GitHub repository secrets:
323-
- `NUGET_API_KEY` - Your PowerShell Gallery API key
358+
- `NUGETAPIKEY_PSGALLERY` - Your PowerShell Gallery API key
324359

325360
The CI/CD pipeline will automatically publish on release.
326361

362+
### Manual Workflow Dispatch
363+
364+
You can manually trigger builds and releases via GitHub Actions workflow dispatch:
365+
366+
1. **Navigate to Actions** → CI workflow
367+
2. **Click "Run workflow"**
368+
3. **Configure options**:
369+
- `version-tag`: Specify a version tag to build (e.g., `v0.9.7`) - leave empty to use current commit
370+
- `publish`: Check to publish the release to PowerShell Gallery
371+
372+
This is useful for:
373+
- Creating releases from specific commits or tags
374+
- Re-publishing existing versions
375+
- Testing release workflows before merging to main
376+
327377
## 🤝 Contributing
328378

329379
We welcome contributions! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) guide for:
@@ -393,6 +443,25 @@ Generates professional documentation:
393443
- Module-level documentation
394444
- Example sections for usage
395445

446+
### CodeQL Semantic Analysis
447+
448+
Advanced security scanning with GitHub CodeQL:
449+
- Runs weekly on a schedule
450+
- Integrates with GitHub Security tab
451+
- Detects complex security vulnerabilities
452+
- Provides actionable security insights
453+
454+
### Automated Maintenance Workflows
455+
456+
Keep your repository clean with automated maintenance:
457+
- **Artifact Cleanup**: Automatically removes artifacts older than 2 days (configurable)
458+
- **Workflow Run Cleanup**: Removes old workflow runs to keep history manageable
459+
- Configurable retention period (default: 2 days)
460+
- Configurable minimum runs to keep (default: 2)
461+
- Separate cleanup for pull requests, pushes, and scheduled runs
462+
- Runs daily at midnight via cron schedule
463+
- Can be triggered manually with custom parameters
464+
396465
## 🎓 Learning Resources
397466

398467
- [PowerShell Best Practices](https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/cmdlet-development-guidelines)

0 commit comments

Comments
 (0)