ci(pr): make InspectCode solution discovery robust under errexit - #274
Merged
Conversation
The Run InspectCode step selected a solution by parsing ls:
SLN=$(ls *.slnx 2>/dev/null | head -n1)
Under GitHub's `shell: bash` (-e -o pipefail), when no .slnx exists `ls`
exits 2, pipefail propagates it, and errexit aborts the whole step (exit 2)
before the .sln fallback runs. Every repo that has only a .sln — i.e.
essentially all of them — fails InspectCode here. It slipped through because
InspectCode needs detect-projects, which failed the protected-file guard on
the job's own introducing PR, so the step never executed before merge.
Replace the ls-parsing with nullglob + array expansion: a non-matching glob
expands to nothing rather than failing, so discovery is correct under
errexit/pipefail by construction — no ls exit-2 to trip on, and no blanket
`|| true` that would also mask a genuine failure. Listing *.slnx before
*.sln keeps .slnx preferred. Also put ~/.dotnet/tools on PATH so `jb`
resolves regardless of runner defaults.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Chris-Wolfgang
force-pushed
the
fix/inspectcode-slnx-glob-errexit
branch
from
July 18, 2026 16:40
8b94d21 to
9d287af
Compare
Chris-Wolfgang
added a commit
to Chris-Wolfgang/repo-template
that referenced
this pull request
Jul 18, 2026
Same fix as Chris-Wolfgang/ETL-Abstractions#274. The Run InspectCode step parsed `ls *.slnx` to pick a solution; under GitHub's `shell: bash` (-e -o pipefail) a no-match `ls` exits 2, pipefail propagates it, and errexit aborts the step before the .sln fallback runs — so any repo that has only a .sln fails InspectCode. Replace ls-parsing with nullglob + array expansion (a non-matching glob expands to nothing, correct under errexit by construction) and put ~/.dotnet/tools on PATH so `jb` resolves. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The blocker
#267 merged the InspectCode job into
mainat 16:04. Because pr.yaml runs viapull_request_target, every open PR now runs InspectCode from main — and it fails at the "Run InspectCode" step with exit code 2, beforejbeven starts (the build step passes). #245 and every other open PR are blocked on this.Root cause
GitHub's
shell: bashruns with-e -o pipefail. The step picked a solution by parsingls:SLN=$(ls *.slnx 2>/dev/null | head -n1)This repo has
ETL-Abstractions.slnbut no.slnx, sols *.slnxexits 2 →pipefailpropagates it →set -eaborts the whole step before the.slnfallback runs. This breaks InspectCode on every repo that has only a.sln(i.e. essentially all of them).It slipped through because InspectCode
needs: detect-projects, and on #267's own PR the protected-file guard failed that job, so InspectCode was skipped and never actually executed before #267 was bypass-merged.Fix
Rather than band-aid the
lspipeline with|| true(which would also mask genuine failures), replace thels-parsing withnullglob+ array expansion:A non-matching glob expands to nothing instead of failing, so discovery is correct under
errexit/pipefailby construction — nolsexit-2 to trip on. Listing*.slnxbefore*.slnkeeps.slnxpreferred. Also puts~/.dotnet/toolsonPATHso thejbglobal tool resolves.Verified in a local
bash -e -o pipefailharness across all four cases: only-.sln, only-.slnx, both (.slnxwins), and neither (fails loudly, exit 1).Merge note
This touches
.github/workflows/pr.yaml(a protected file), so Detect .NET Projects will fail by design — it's the only expected failure. Needs an admin-bypass merge. Once merged, I'll re-run InspectCode on #245 (and the other open PRs) to confirm green.The same bug exists in the canonical repo-template; I'll fold this fix into the open feed-back PR #439.