Skip to content

fix: allow dot-sourced install in CI with opt-out - #138

Merged
chawyehsu merged 4 commits into
ScoopInstaller:masterfrom
chawyehsu:push-kosykwzmqqlo
Aug 27, 2026
Merged

fix: allow dot-sourced install in CI with opt-out#138
chawyehsu merged 4 commits into
ScoopInstaller:masterfrom
chawyehsu:push-kosykwzmqqlo

Conversation

@chawyehsu

Copy link
Copy Markdown
Member

fix regression in #136

The initial goal of #136 was to decouple function imports from the install flow so that installing Scoop wouldn't be triggered in our tests. However, I overlooked the fact that CI environments (such as GitHub Actions) execute script blocks within job steps using dot-sourcing; consequently, the changes in #136 broke the standard run: irm get.scoop.sh | iex usage.

This PR restores the original behavior while still preventing Scoop installation during tests, by allowing triggering the install flow when the $env:CI variable is present, while also providing a SCOOP_NOINSTALL environment variable to opt out of the install flow.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 16 minutes.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ea74755b-2c84-4903-b51a-84f7a5a868b2

📥 Commits

Reviewing files that changed from the base of the PR and between 8499239 and 6328555.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fb525d1e-787a-4c92-a0bc-1ee570704f3d

📥 Commits

Reviewing files that changed from the base of the PR and between c33d455 and 8499239.

📒 Files selected for processing (1)
  • install.ps1

Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review.


Summary by CodeRabbit

  • Bug Fixes

    • Improved installer behavior across interactive, automated, and dot-sourced PowerShell execution.
    • Installation now runs by default in CI when invoked through PowerShell, unless explicitly disabled.
    • Added support for disabling installation with SCOOP_NOINSTALL values such as true, yes, on, or 1.
  • Tests

    • Added coverage for preserving and restoring installation settings.
    • Added Windows CI validation for installation through both PowerShell invocation modes.

Walkthrough

The installer adds Test-ShouldRunInstall to evaluate invocation mode, CI status, and SCOOP_NOINSTALL. Tests isolate the environment variable, and CI evaluates the installer under PowerShell and pwsh.

Changes

Install gating

Layer / File(s) Summary
Install execution predicate
install.ps1
Test-ShouldRunInstall evaluates invocation mode, CI status, and SCOOP_NOINSTALL. The install trigger calls this function.
Environment isolation in tests
test/install.Tests.ps1
The tests set SCOOP_NOINSTALL to true, then restore its original value or remove it after execution.
CI invocation coverage
.github/workflows/ci.yml
The ci_iex job evaluates install.ps1 through Invoke-Expression under PowerShell and pwsh, then runs scoop help.

Merge Risk: 🟠 High · up to 84992

The CI workflow runs repository code while checkout credentials remain available and grants a broader token than necessary, which could expose credentials or enable unintended repository actions if the executed code is compromised. Merge should wait for workflow hardening or explicit security acceptance.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: permitting dot-sourced installation in CI while supporting an opt-out.
Description check ✅ Passed The description directly explains the CI regression, the restored install flow, and the SCOOP_NOINSTALL opt-out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 11922b19-302f-4460-a9d2-2c80554944d9

📥 Commits

Reviewing files that changed from the base of the PR and between c64d414 and 7f55145.

📒 Files selected for processing (2)
  • install.ps1
  • test/install.Tests.ps1

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread install.ps1
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 43b54f19-8a10-4c20-bc28-e056f34f392d

📥 Commits

Reviewing files that changed from the base of the PR and between 7f55145 and 183da97.

📒 Files selected for processing (1)
  • install.ps1

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Comment thread install.ps1 Outdated
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e7b8b763-0cb1-4364-a368-5dc59b994d4b

📥 Commits

Reviewing files that changed from the base of the PR and between 183da97 and c33d455.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
@chawyehsu
chawyehsu merged commit 9ad51a7 into ScoopInstaller:master Aug 27, 2026
6 checks passed
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.

1 participant