fix(ci): check-proto-changes-python can never fail - #8205
Open
Abdellah Ouadoudi (holistis) wants to merge 1 commit into
Open
fix(ci): check-proto-changes-python can never fail#8205Abdellah Ouadoudi (holistis) wants to merge 1 commit into
Abdellah Ouadoudi (holistis) wants to merge 1 commit into
Conversation
…stale The `Process changes` step only echoed a message when `has-changes-action` detected uncommitted changes; it never exited non-zero. Combined with `UnicornGlobal/has-changes-action` itself only setting an output (by design, per its own README) and not failing the step, the `check-proto-changes-python` job cannot fail, no matter how out of sync the generated proto files are with what's committed. This is a regression from commit 5be7ac7 ("Move reset from a message to a command", microsoft#4073), which replaced the original inline `git status --porcelain` + `exit 1` check (added in microsoft#451, refined in a follow-up commit to also print the diff) with the has-changes-action README's demo snippet verbatim - the demo intentionally omits a failure step since the action's job is only to expose the `changed` output for callers to act on. Net effect: the job has shown green on every run since 2024-11-06 regardless of whether `poe gen-proto` / `poe gen-test-proto` output matches what's committed, silently defeating the check's only purpose. Fix: add `exit 1` (and keep printing the diff, as the pre-regression step did) so the job actually fails when generated proto files are not up to date. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Why are these changes needed?
The
check-proto-changes-pythonjob in.github/workflows/checks.ymlis supposed to fail CI when the generated proto files (poe gen-proto/poe gen-test-proto) are out of sync with what's committed. It currently cannot fail, regardless of the actual diff.Root cause
UnicornGlobal/has-changes-actiononly sets an output (changed); by design (see its README) it never fails the step itself - it exists purely so a caller can branch on the result.Process changesstep only runsecho .... There is noexit 1(or any other failing command), so the step - and therefore the job - always reports success, even whenchanged == 1.I verified the has-changes-action's
action.yml(docker action, only produces an output) and its README (the linked example is literallyrun: echo "Changes exist", i.e. a demo of the output variable, not a working check) to confirm there is no other path that could fail the job.How it got here
Original check (added in #451, refined in a follow-up commit) worked correctly:
Commit 5be7ac7 ("Move reset from a message to a command", #4073 - an unrelated PR) swapped this for the has-changes-action README's demo snippet verbatim, dropping the
exit 1. Net effect: this job has shown green on every run since 2024-11-06, independent of whether the generated protos actually match what's committed.I confirmed on a recent successful run on
main(workflow run 24054593367, jobcheck-proto-changes-python) that the job exists and passes today; the logic above shows why a "success" here carries no information.Fix
Restore a real failure path while keeping the current step structure (minimal diff, no third-party-action swap):
Verified the fix locally by extracting the exact step body before/after as a shell script and running both with the guard condition true (i.e. simulating "proto files are stale"):
echo ...-> exit code0(bug: job stays green)echo ...; git --no-pager diff; exit 1-> exit code1(job correctly fails)The
if:guard itself is untouched, so the happy path (no diff ->changed == 0-> step skipped -> job green) is unaffected.Related issue number
None filed - this is a small, self-contained CI fix with git-history evidence for the regression; happy to open an issue first if preferred.
Checks
.github/workflowsstep body.)🤖 Generated with Claude Code