Conversation
Update test step to use .runsettings file if available.
Update test step to use .runsettings file if available.
Update test step to use PowerShell and check for settings file.
Updated test step to use PowerShell and check for settings file.
WalkthroughTest steps in four GitHub Actions workflows now run under PowerShell and conditionally check for a workspace Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/build_test.yml (1)
281-291: Consider centralizing this test-settings logic to avoid driftThis same block now exists in four workflows. A small reusable workflow/composite action for
dotnet test+ optional settings would keep behavior consistent and reduce future copy/paste divergence.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/build_test.yml around lines 281 - 291, The Test step duplicated across workflows should be extracted into a reusable workflow or composite action that accepts an optional settings file input (e.g. settings_file) and runs the same dotnet test invocation with --collect:"XPlat Code Coverage"; implement a new workflow/action that checks the provided settings_file (default ".runtestsettings") and runs dotnet test with or without --settings accordingly, then replace each existing "Test" step (the powershell block referencing $settingsFile and dotnet test) with a call to this reusable workflow using the inputs to ensure consistent behavior and avoid drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/linux_build_test.yml:
- Line 285: The fallback log message uses the wrong filename: update the string
"No .runsettings file found. Running with default settings." to reference the
actual file being checked (".runtestsettings") so the message matches the
condition in the workflow; locate the echo/Write-Host statement that prints that
message in the linux_build_test.yml and change the filename text to
".runtestsettings".
- Around line 280-283: The script currently checks a relative $settingsFile
(".runtestsettings") under the current working directory (inputs.workdir) which
can miss a workspace-root file; update the creation and checks to resolve the
workspace-root path: set $settingsFile = Join-Path $env:GITHUB_WORKSPACE
".runtestsettings" (or use Resolve-Path on that Join-Path), then Test-Path
$settingsFile and call dotnet test --settings $settingsFile --collect:"XPlat
Code Coverage", updating the Write-Host to indicate the resolved workspace path;
use the existing $settingsFile variable and existing Test-Path/dotnet test calls
so only the path resolution changes.
---
Nitpick comments:
In @.github/workflows/build_test.yml:
- Around line 281-291: The Test step duplicated across workflows should be
extracted into a reusable workflow or composite action that accepts an optional
settings file input (e.g. settings_file) and runs the same dotnet test
invocation with --collect:"XPlat Code Coverage"; implement a new workflow/action
that checks the provided settings_file (default ".runtestsettings") and runs
dotnet test with or without --settings accordingly, then replace each existing
"Test" step (the powershell block referencing $settingsFile and dotnet test)
with a call to this reusable workflow using the inputs to ensure consistent
behavior and avoid drift.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e9b13b84-fbf6-4b01-9d60-8d5aa15dda13
📒 Files selected for processing (4)
.github/workflows/build_main.yml.github/workflows/build_test.yml.github/workflows/linux_build_main.yml.github/workflows/linux_build_test.yml
| $settingsFile = ".runtestsettings" | ||
| if (Test-Path $settingsFile) { | ||
| Write-Host "Using $settingsFile found in workspace." | ||
| dotnet test --settings $settingsFile --collect:"XPlat Code Coverage" |
There was a problem hiding this comment.
Resolve test settings path from workspace root to avoid silent misses
Line 280 uses a relative .runtestsettings, which is evaluated under ${{ inputs.workdir }} (Line 99). If workdir is not ., root-level settings are ignored and tests run with unintended defaults.
Proposed fix
- $settingsFile = ".runtestsettings"
- if (Test-Path $settingsFile) {
+ $settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings"
+ if (Test-Path -LiteralPath $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
} else {
- Write-Host "No .runsettings file found. Running with default settings."
+ Write-Host "No .runtestsettings file found. Running with default settings."
dotnet test --collect:"XPlat Code Coverage"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| $settingsFile = ".runtestsettings" | |
| if (Test-Path $settingsFile) { | |
| Write-Host "Using $settingsFile found in workspace." | |
| dotnet test --settings $settingsFile --collect:"XPlat Code Coverage" | |
| $settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings" | |
| if (Test-Path -LiteralPath $settingsFile) { | |
| Write-Host "Using $settingsFile found in workspace." | |
| dotnet test --settings $settingsFile --collect:"XPlat Code Coverage" | |
| } else { | |
| Write-Host "No .runtestsettings file found. Running with default settings." | |
| dotnet test --collect:"XPlat Code Coverage" | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/linux_build_test.yml around lines 280 - 283, The script
currently checks a relative $settingsFile (".runtestsettings") under the current
working directory (inputs.workdir) which can miss a workspace-root file; update
the creation and checks to resolve the workspace-root path: set $settingsFile =
Join-Path $env:GITHUB_WORKSPACE ".runtestsettings" (or use Resolve-Path on that
Join-Path), then Test-Path $settingsFile and call dotnet test --settings
$settingsFile --collect:"XPlat Code Coverage", updating the Write-Host to
indicate the resolved workspace path; use the existing $settingsFile variable
and existing Test-Path/dotnet test calls so only the path resolution changes.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/build_main.yml:
- Around line 264-271: The Test step currently sets $settingsFile =
".runtestsettings" which resolves relative to inputs.workdir instead of the
repository root; change the path resolution to target the workspace root (e.g.,
build $settingsFile using the GITHUB_WORKSPACE environment variable or Join-Path
with $Env:GITHUB_WORKSPACE) so Test-Path and the subsequent dotnet test
--settings invocation always check the repo root .runtestsettings; update the
Write-Host messages accordingly to reflect the resolved path and ensure both
branches still run dotnet test with --collect:"XPlat Code Coverage".
In @.github/workflows/build_test.yml:
- Around line 284-291: The workflow currently checks for ".runtestsettings"
using a relative path which resolves against the runner working directory
(inputs.workdir); change the check to resolve against the repository root by
building the absolute path from the workspace root (use $env:GITHUB_WORKSPACE or
the workflow expression github.workspace) — e.g. set $settingsFile = Join-Path
$env:GITHUB_WORKSPACE '.runtestsettings' and then Test-Path $settingsFile; apply
the same change to the other workflow files (linux_build_test.yml,
build_main.yml, linux_build_main.yml) so all checks use the workspace root
instead of inputs.workdir.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2a82a6ed-8ed4-4ac2-abe2-4e74abf24c38
📒 Files selected for processing (4)
.github/workflows/build_main.yml.github/workflows/build_test.yml.github/workflows/linux_build_main.yml.github/workflows/linux_build_test.yml
✅ Files skipped from review due to trivial changes (1)
- .github/workflows/linux_build_main.yml
| $settingsFile = ".runtestsettings" | ||
| if (Test-Path $settingsFile) { | ||
| Write-Host "Using $settingsFile found in workspace." | ||
| dotnet test --settings $settingsFile --collect:"XPlat Code Coverage" | ||
| } else { | ||
| Write-Host "No $settingsFile file found. Running with default settings." | ||
| dotnet test --collect:"XPlat Code Coverage" | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check if the file exists and examine the relevant lines
find . -name "build_main.yml" -type fRepository: FrendsPlatform/FrendsTasks
Length of output: 104
🏁 Script executed:
# Once we have the file, let's examine the context around lines 264-271 and line 80
if [ -f ".github/workflows/build_main.yml" ]; then
echo "=== Lines 260-280 (context around 264-271) ==="
sed -n '260,280p' .github/workflows/build_main.yml
echo ""
echo "=== Lines 75-85 (context around line 80) ==="
sed -n '75,85p' .github/workflows/build_main.yml
fiRepository: FrendsPlatform/FrendsTasks
Length of output: 1235
🏁 Script executed:
# Let's also get the full context of the workflow to understand when workdir is changed
wc -l .github/workflows/build_main.ymlRepository: FrendsPlatform/FrendsTasks
Length of output: 106
🏁 Script executed:
# Search for other uses of relative paths in the workflow
sed -n '1,315p' .github/workflows/build_main.yml | grep -n "\.runtestsettings\|working-directory\|inputs\.workdir" | head -20Repository: FrendsPlatform/FrendsTasks
Length of output: 321
🏁 Script executed:
# Look at the Build step to see if it has a similar issue or different handling
sed -n '240,265p' .github/workflows/build_main.ymlRepository: FrendsPlatform/FrendsTasks
Length of output: 883
🏁 Script executed:
# Check the Build step to see if it has a similar issue or if this was already fixed
sed -n '200,260p' .github/workflows/build_main.ymlRepository: FrendsPlatform/FrendsTasks
Length of output: 2085
🏁 Script executed:
# Also check if there are any steps that override working-directory
grep -n "working-directory:" .github/workflows/build_main.ymlRepository: FrendsPlatform/FrendsTasks
Length of output: 121
Same path-resolution bug in Test step (.runtestsettings is relative to workdir)
Line 264 resolves .runtestsettings relative to ${{ inputs.workdir }} (defined at line 80), not workspace root. Repos with non-root workdir won't pick up root-level test settings.
Proposed fix
- $settingsFile = ".runtestsettings"
- if (Test-Path $settingsFile) {
+ $settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings"
+ if (Test-Path -LiteralPath $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
} else {
Write-Host "No $settingsFile file found. Running with default settings."
dotnet test --collect:"XPlat Code Coverage"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| $settingsFile = ".runtestsettings" | |
| if (Test-Path $settingsFile) { | |
| Write-Host "Using $settingsFile found in workspace." | |
| dotnet test --settings $settingsFile --collect:"XPlat Code Coverage" | |
| } else { | |
| Write-Host "No $settingsFile file found. Running with default settings." | |
| dotnet test --collect:"XPlat Code Coverage" | |
| } | |
| $settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings" | |
| if (Test-Path -LiteralPath $settingsFile) { | |
| Write-Host "Using $settingsFile found in workspace." | |
| dotnet test --settings $settingsFile --collect:"XPlat Code Coverage" | |
| } else { | |
| Write-Host "No $settingsFile file found. Running with default settings." | |
| dotnet test --collect:"XPlat Code Coverage" | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/build_main.yml around lines 264 - 271, The Test step
currently sets $settingsFile = ".runtestsettings" which resolves relative to
inputs.workdir instead of the repository root; change the path resolution to
target the workspace root (e.g., build $settingsFile using the GITHUB_WORKSPACE
environment variable or Join-Path with $Env:GITHUB_WORKSPACE) so Test-Path and
the subsequent dotnet test --settings invocation always check the repo root
.runtestsettings; update the Write-Host messages accordingly to reflect the
resolved path and ensure both branches still run dotnet test with
--collect:"XPlat Code Coverage".
| $settingsFile = ".runtestsettings" | ||
| if (Test-Path $settingsFile) { | ||
| Write-Host "Using $settingsFile found in workspace." | ||
| dotnet test --settings $settingsFile --collect:"XPlat Code Coverage" | ||
| } else { | ||
| Write-Host "No $settingsFile file found. Running with default settings." | ||
| dotnet test --collect:"XPlat Code Coverage" | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify whether workflow test steps use relative .runtestsettings while workdir is overridden.
rg -n -C2 'working-directory:\s*\$\{\{\s*inputs\.workdir\s*\}\}|\$settingsFile\s*=\s*"\.runtestsettings"|dotnet test --settings' .github/workflows/*.ymlRepository: FrendsPlatform/FrendsTasks
Length of output: 4365
Resolve .runtestsettings from workspace root, not inputs.workdir
Line 284 uses a relative path, but line 100 sets the runner working directory to ${{ inputs.workdir }}. This causes the code to search for .runtestsettings relative to inputs.workdir instead of the workspace root, potentially missing a workspace-root .runtestsettings and silently running tests with defaults.
Proposed fix
- $settingsFile = ".runtestsettings"
- if (Test-Path $settingsFile) {
+ $settingsFile = Join-Path $env:GITHUB_WORKSPACE ".runtestsettings"
+ if (Test-Path -LiteralPath $settingsFile) {
Write-Host "Using $settingsFile found in workspace."
dotnet test --settings $settingsFile --collect:"XPlat Code Coverage"
} else {
Write-Host "No $settingsFile file found. Running with default settings."
dotnet test --collect:"XPlat Code Coverage"
}Note: The same pattern appears in linux_build_test.yml, build_main.yml, and linux_build_main.yml and should be fixed consistently across all affected workflows.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/build_test.yml around lines 284 - 291, The workflow
currently checks for ".runtestsettings" using a relative path which resolves
against the runner working directory (inputs.workdir); change the check to
resolve against the repository root by building the absolute path from the
workspace root (use $env:GITHUB_WORKSPACE or the workflow expression
github.workspace) — e.g. set $settingsFile = Join-Path $env:GITHUB_WORKSPACE
'.runtestsettings' and then Test-Path $settingsFile; apply the same change to
the other workflow files (linux_build_test.yml, build_main.yml,
linux_build_main.yml) so all checks use the workspace root instead of
inputs.workdir.
Summary by CodeRabbit