Skip to content

🩹 [Patch]: Setup/teardown jobs no longer waste runner time when scripts are absent#300

Merged
Marius Storhaug (MariusStorhaug) merged 1 commit intomainfrom
fix/skip-before-after-all-when-scripts-missing
Mar 27, 2026
Merged

🩹 [Patch]: Setup/teardown jobs no longer waste runner time when scripts are absent#300
Marius Storhaug (MariusStorhaug) merged 1 commit intomainfrom
fix/skip-before-after-all-when-scripts-missing

Conversation

@MariusStorhaug
Copy link
Copy Markdown
Member

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.

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-PSModuleSettings from v1.4.3 (3d53e12) to v1.4.4 (21c88f4) in Get-Settings.yml.
  • The action change (PSModule/Get-PSModuleSettings#18) adds Test-Path checks for the setup/teardown scripts and sets the Run.BeforeAllModuleLocal / Run.AfterAllModuleLocal flags accordingly, which the existing workflow if: conditions already respect.
  • No structural changes to any reusable workflow files — only a SHA pin update.

@github-actions
Copy link
Copy Markdown

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

1 similar comment
@github-actions
Copy link
Copy Markdown

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title ⚙️ [Maintenance]: Setup/teardown jobs no longer waste runner time when scripts are absent 🩹 [Patch]: Setup/teardown jobs no longer waste runner time when scripts are absent Mar 27, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review March 27, 2026 22:32
Copilot AI review requested due to automatic review settings March 27, 2026 22:32
@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit 4343d76 into main Mar 27, 2026
50 of 51 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the fix/skip-before-after-all-when-scripts-missing branch March 27, 2026 22:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Get-Settings reusable workflow to use the newer PSModule/Get-PSModuleSettings action version so setup/teardown job run flags can be evaluated earlier (avoiding runner allocation when scripts are absent).

Changes:

  • Bump PSModule/Get-PSModuleSettings from v1.4.3 to v1.4.4 by updating the pinned commit SHA in Get-Settings.yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip BeforeAll/AfterAll-ModuleLocal jobs when setup/teardown scripts do not exist

2 participants