Skip to content

fix: Skip PSScriptAnalyzer install on cache hit#12

Merged
tablackburn merged 3 commits into
mainfrom
bugfix/ci-lint-cache-conditional-install
Apr 9, 2026
Merged

fix: Skip PSScriptAnalyzer install on cache hit#12
tablackburn merged 3 commits into
mainfrom
bugfix/ci-lint-cache-conditional-install

Conversation

@tablackburn
Copy link
Copy Markdown
Owner

@tablackburn tablackburn commented Apr 9, 2026

Summary

  • The lint job was unconditionally running Install-Module even when PSScriptAnalyzer was already restored from cache
  • This caused Install-Module -Force to conflict with the already-loaded cached module, which can trigger a NullReferenceException in PSScriptAnalyzer
  • Added id to the cache step and an if condition on the install step so it only runs on cache miss
  • Added workflow_dispatch trigger to allow manual CI runs

Test Plan

Note: This is a template repository — CI workflows are not intended to run here. When using this template to create a new repository, verify the following:

  • CI lint job passes with a cold cache (no prior cache entry)
  • On a subsequent run with a warm cache, the Install-Module step is skipped
  • workflow_dispatch trigger allows manual CI runs from the Actions tab

🤖 Generated with Claude Code

The lint job was unconditionally running Install-Module even when the
module was already restored from cache. This caused Install-Module
-Force to conflict with the already-loaded cached module, which can
trigger a NullReferenceException in PSScriptAnalyzer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 9, 2026 00:38
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

Adds workflow_dispatch manual trigger to the CI workflow, assigns an explicit step ID (cache-lint-modules) to the PowerShell module cache step, and makes the Install PSScriptAnalyzer step conditional on steps.cache-lint-modules.outputs.cache-hit != 'true'.

Changes

Cohort / File(s) Summary
CI Workflow
/.github/workflows/CI.yaml
Added workflow_dispatch manual trigger; set explicit step ID cache-lint-modules for PowerShell module cache; made PSScriptAnalyzer installation run only when cache miss (if: steps.cache-lint-modules.outputs.cache-hit != 'true').

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐇 I named the cache, I set the rule,
Skip installs when modules stay cool.
A tiny tweak, a faster run,
CI hops forward—job well done! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely summarizes the main fix: adding a conditional check to skip PSScriptAnalyzer installation when the cache is already hit.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/ci-lint-cache-conditional-install

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

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 CI lint workflow to avoid reinstalling PSScriptAnalyzer when it’s already restored from the GitHub Actions cache, preventing install/load conflicts during lint runs.

Changes:

  • Adds a step id to the PowerShell modules cache step.
  • Gates the Install PSScriptAnalyzer step to only run on cache misses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/CI.yaml
@tablackburn tablackburn merged commit c1bab46 into main Apr 9, 2026
3 of 7 checks passed
@tablackburn tablackburn deleted the bugfix/ci-lint-cache-conditional-install branch April 9, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants