ci: delegate to PowerShellOrg reusable workflows#184
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the repository’s GitHub Actions configuration to PowerShellOrg reusable workflows and aligns the repo’s psake tasks with what those workflows expect (including a dedicated Analyze task and publish API key wiring).
Changes:
- Replace the existing multi-job CI workflow with a single call to
PowerShellOrg/.github’spowershell-ci.yml. - Add a tag-triggered (and manually triggerable) publish workflow delegating to
powershell-release.yml. - Add a new
Analyzepsake task that runs PSScriptAnalyzer on the staged module output; wire publish API key fromPSGALLERY_API_KEY.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| psakeFile.ps1 | Adds Analyze task and maps $env:PSGALLERY_API_KEY into PowerShellBuild publish preferences. |
| .github/workflows/ci.yml | Simplifies CI to a single reusable workflow invocation. |
| .github/workflows/publish.yml | Adds release workflow that delegates publishing/release steps to a reusable workflow. |
Comments suppressed due to low confidence (1)
.github/workflows/ci.yml:25
- This change removes the in-repo step that published JUnit test results as PR check runs (previously via
publish-unit-test-result-action). If that reporting is still desired, ensurepowershell-ci.ymlprovides equivalent test result publishing, or add it back in this workflow.
jobs:
ci:
uses: PowerShellOrg/.github/.github/workflows/powershell-ci.yml@main
permissions:
contents: read
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $PSBPreference.Test.ExcludeTagFilter = @('WindowsOnly') | ||
| } | ||
|
|
||
| $PSBPreference.Publish.ApiKey = $env:PSGALLERY_API_KEY |
| $results = Invoke-ScriptAnalyzer -Path $PSBPreference.Build.ModuleOutDir -Recurse -Severity Error | ||
| if ($results) { | ||
| $results | Format-Table -AutoSize | ||
| throw "PSScriptAnalyzer found $($results.Count) error(s)." |
| ci: | ||
| uses: PowerShellOrg/.github/.github/workflows/powershell-ci.yml@main | ||
| permissions: | ||
| contents: read |
| release: | ||
| uses: PowerShellOrg/.github/.github/workflows/powershell-release.yml@main | ||
| with: | ||
| module-name: PSDepend | ||
| secrets: | ||
| PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} | ||
| permissions: | ||
| contents: write |
- CI.yml now calls powershell-ci.yml@main (PS 5.1 + 7.x, all platforms, installs deps and runs Init/Test/Analyze directly via Invoke-psake) - publish.yml added: triggers on v* tags, calls powershell-release.yml@main (Init → Test → Analyze → Build → Publish → GitHub Release) - psakeFile.ps1: add Analyze task (required by both reusable workflows) and wire $PSBPreference.Publish.ApiKey from $env:PSGALLERY_API_KEY Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2c1a6d4 to
52cd558
Compare
| Task InstallLocal -Depends StageFiles { | ||
| $label = if ($PreReleaseLabel) { $PreReleaseLabel } else { "pre-$(git rev-parse --short HEAD)" } | ||
| $label = if ($PreReleaseLabel) { | ||
| $PreReleaseLabel |
There was a problem hiding this comment.
[PSScriptAnalyzer] reported by reviewdog 🐶
| $PreReleaseLabel | |
| $PreReleaseLabel |
| $label = if ($PreReleaseLabel) { | ||
| $PreReleaseLabel | ||
| } else { | ||
| "pre-$(git rev-parse --short HEAD)" |
There was a problem hiding this comment.
[PSScriptAnalyzer] reported by reviewdog 🐶
| "pre-$(git rev-parse --short HEAD)" | |
| "pre-$(git rev-parse --short HEAD)" |
Test Results 3 files - 1 60 suites - 20 1m 57s ⏱️ -24s Results for commit 52cd558. ± Comparison against base commit 61060f3. This pull request removes 411 tests. |
Summary
uses:call toPowerShellOrg/.github/.github/workflows/powershell-ci.yml@main— covers PS 5.1 and 7.x on Windows/Linux/macOS, installs deps, and runs Init/Test/Analyze viaInvoke-psakev*tag push, delegates topowershell-release.yml@main(Init → Test → Analyze → Build → Publish → GitHub Release); requiresPSGALLERY_API_KEYsecret set in repo settingsAnalyzetask (runsInvoke-ScriptAnalyzeron staged output, fails on Error severity); wired$PSBPreference.Publish.ApiKeyfrom$env:PSGALLERY_API_KEYTest plan
PSGALLERY_API_KEYsecret is set in repo settings before tagging a releasepublish.ymlviaworkflow_dispatchon a pre-release branch🤖 Generated with Claude Code