-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(import-bucket-tests): fix Get-GitChangedFile Include pattern for CI
#6395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
In the meantime, I'm patching it in my ci.yml. See BinToss/scoop-bucket@f1cc5a7 |
WalkthroughRestricts CI manifest discovery in test/Import-Bucket-Tests.ps1 to JSON files under the bucket subpath when env:CI is true, and adds an Unreleased Bug Fix entry to CHANGELOG.md noting the Include-pattern fix (commit 93b9bae). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor CI as CI Runner
participant Tests as Import-Bucket-Tests.ps1
participant Git as Get-GitChangedFile
CI->>Tests: Run tests (env:CI = true)
note right of Tests: Determine changed manifests
rect rgba(200,235,255,0.3)
Tests->>Git: Get-GitChangedFile -Path $bucketDir\n-Include "$((Get-Item $bucketDir).Name)/*.json"\n-Commit $env:BHCommitHash
Git-->>Tests: JSON files under bucket subpath
end
Tests->>Tests: Validate manifests against schema
Tests-->>CI: Report results
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
CHANGELOG.md (1)
9-9: Changelog entry looks good; consider casing consistency.Optional: other Bug Fixes entries often start with “Fix …”. If you want consistency, change “fix” → “Fix”.
- - **import-bucket-tests:** fix `Get-GitChangedFile` `Include` pattern for CI ([93b9bae](https://github.com/ScoopInstaller/Scoop/commit/93b9bae33a88ccde6590c4df3f589f47c58a527e)) + - **import-bucket-tests:** Fix `Get-GitChangedFile` `Include` pattern for CI ([93b9bae](https://github.com/ScoopInstaller/Scoop/commit/93b9bae33a88ccde6590c4df3f589f47c58a527e))test/Import-Bucket-Tests.ps1 (1)
19-19: Good fix: scopes to bucket JSONs in CI.Prepending the bucket directory name to the Include pattern should stop non-manifest JSONs (e.g., .vscode/settings.json) from being validated in CI.
If manifests might live in subfolders in some buckets, consider also matching one nested level:
- $manifestFiles = @(Get-GitChangedFile -Path $bucketDir -Include "$((Get-Item $bucketDir).Name)/*.json" -Commit $env:BHCommitHash) + $bucketName = (Split-Path -Leaf $bucketDir) + $manifestFiles = @(Get-GitChangedFile -Path $bucketDir -Include @("$bucketName/*.json", "$bucketName/*/*.json") -Commit $env:BHCommitHash)Please confirm whether any official buckets place manifests in subdirectories. If not, keeping only "$bucketName/*.json" is fine and simplest.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
CHANGELOG.md(1 hunks)test/Import-Bucket-Tests.ps1(1 hunks)
…for CI Prepending the name of the `$bucketDir` to the `Get-GitChangedFile` `Include` pattern narrows the pattern to only include bucket manifests. Previously, when `$ENV:CI` is `$true`, the "Manifest validates against the schema" test would test _all_ changed JSON files in the repo (e.g. ".vscode/settings.json"). `Get-GitChangedFile`'s `Path` parameter seemed to have been used to specify the bucket directory, but `Get-GitChangedFile` only uses it for finding a repo root.
Description
Prepend the name of the
$bucketDirtoGet-GitChangedFile'sIncludepattern to narrow the pattern to include only bucket manifests (i.e. include"./bucket/*.json"instead of"./**/*.json").Previously, when
$ENV:CIis$true, the "Manifest validates against the schema" test would test all changed JSON files in the repo (e.g. ".vscode/settings.json").Get-GitChangedFile'sPathparameter seemed to have been used to specify the bucket directory, butGet-GitChangedFileonly uses it for finding a repo root.Motivation and Context
Fixes #6394
How Has This Been Tested?
Local debug runs of "Scoop-Bucket.Tests.ps1" with
$env:CIset to$true.Additionally,
. ./test/bin/test.ps1succeeds locally in PowerShell 7.5.1 and Windows PowerShell 5.1.22621.4391Checklist:
developbranch.Summary by CodeRabbit