🩹 [Patch]: Setup/teardown jobs no longer waste runner time when scripts are absent (#300)
The BeforeAll-ModuleLocal and AfterAll-ModuleLocal workflow jobs no longer allocate runners when the corresponding tests/BeforeAll.ps1 or tests/AfterAll.ps1 scripts do not exist in the repository. Repositories without setup/teardown scripts now skip these jobs entirely, saving runner time on every workflow run.
- Fixes #288
Changed: Runner allocation for setup/teardown jobs
With the Get-PSModuleSettings v1.4.4 update, repositories without tests/BeforeAll.ps1 or tests/AfterAll.ps1 no longer allocate runners for the BeforeAll-ModuleLocal and AfterAll-ModuleLocal jobs. These jobs are now skipped entirely at the settings evaluation stage, before any runner is provisioned.
Previously, both jobs always spun up a runner — even when there was nothing to execute. The runner would check out the repo, invoke the GitHub-Script action, find no script, and exit gracefully. This wasted runner time on every workflow run for the majority of repositories.
Additionally, AfterAllModuleLocal was previously set to $true unconditionally. It now uses the same base conditions as BeforeAllModuleLocal combined with the script existence check. The workflow-level always() condition remains as an additional safeguard for cleanup-after-failure scenarios.
Technical Details
- Bumps
PSModule/Get-PSModuleSettingsfromv1.4.3(3d53e12) tov1.4.4(21c88f4) inGet-Settings.yml. - The action change (PSModule/Get-PSModuleSettings#18) adds
Test-Pathchecks for the setup/teardown scripts and sets theRun.BeforeAllModuleLocal/Run.AfterAllModuleLocalflags accordingly, which the existing workflowif:conditions already respect. - No structural changes to any reusable workflow files — only a SHA pin update.