Commit 5577e74
committed
fix: stderr is not part of the JSON
run_check_json ran commit-check with stderr=subprocess.STDOUT and handed
the merged stream to json.loads. The CLI's contract is the opposite:
stdout is the JSON and nothing else, stderr is what it has to say to a
person. Merged, any such line makes the response unparsable -- and an
unparsable response is a failure as far as ScopeResult is concerned, so
a passing run goes red:
$ commit-check --format json --branch # conventional_branch = false
⊘ --branch requested but no branch rules are configured
(conventional_branch = false and no require_rebase_target)
{ "status": "pass", "warnings": 0, "checks": [] }
-> json.loads fails -> ScopeResult(raw_text=...) -> status "fail"
-> exit_code_for -> 1, on a run where the CLI itself exited 0.
commit-check 2.17.1 adds two lines that reach this path, and the action
asks for branch checks by default: the notice above (any repository whose
config switched the branch rules off) and an inherit_from that could not
be fetched (a private .github repository, a typo'd URL, a network blip).
A dry run prints one too. None of them is a verdict, and the CLI fails
open on the second on purpose.
Read the two streams separately: stdout goes to the parser, stderr goes
to the job log, deduplicated -- the action runs commit-check once per
scope and once per commit in the pull request, and a notice about the
configuration is the same every time.
When there is no JSON to protect the two are joined again, so an
unparsable run still shows everything the CLI said. That path matters
more than it looks: a config the CLI refuses leaves stdout empty and
prints "Error: ..." on stderr, and dropping it would leave an empty
raw_text that reads as a pass.1 parent fd3d923 commit 5577e74
2 files changed
Lines changed: 120 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
495 | 513 | | |
496 | 514 | | |
497 | 515 | | |
498 | 516 | | |
499 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
500 | 526 | | |
501 | | - | |
| 527 | + | |
| 528 | + | |
502 | 529 | | |
503 | 530 | | |
504 | 531 | | |
505 | 532 | | |
506 | 533 | | |
507 | 534 | | |
508 | | - | |
| 535 | + | |
509 | 536 | | |
510 | 537 | | |
511 | 538 | | |
512 | 539 | | |
513 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
514 | 543 | | |
515 | | - | |
| 544 | + | |
516 | 545 | | |
517 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
518 | 555 | | |
519 | 556 | | |
520 | 557 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
355 | | - | |
| 355 | + | |
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
| 391 | + | |
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| |||
2841 | 2841 | | |
2842 | 2842 | | |
2843 | 2843 | | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
0 commit comments