Skip to content

Commit 41eb8cd

Browse files
authored
feat: render a warned rule as a warning, not a failure (#276)
commit-check's CLI reports a rule listed under the config's top-level warn as status "warn" rather than "fail" (commit-check#565). The action's report follows: a warned scope gets its own row in the Warnings table (alongside the existing Failed checks table), its own ⚠ line in the step log and details block, and a ::warning annotation instead of ::error — but it never turns the workflow red. It counts toward "passed" in the verdict instead, e.g. "3 of 4 checks passed, 1 warning". A real failure still fails the run even when a warning sits in the same scope (CC202 stands in for branch when the two disagree), and the verdict then names both: "N of M checks failed, K warnings". ScopeResult.status and .warnings, overall_status/exit_code_for (warn already fell through to "pass", now documented), _render_scopes, render_step_log's annotations, and render_report/_markdown_table all follow. Against an older engine, or a config with no warn list, no check can ever be a warning, and every existing golden-output test keeps passing unchanged.
1 parent 1893d04 commit 41eb8cd

3 files changed

Lines changed: 367 additions & 55 deletions

File tree

‎README.md‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ for all available options.
203203
> [Optional Inputs](#optional-inputs), so env vars and config files are the
204204
> recommended way to customize.
205205

206+
The config's top-level `warn` reports a rule without failing the run — see
207+
[Warning Job Summary](#warning-job-summary) for what that looks like:
208+
209+
```toml
210+
warn = ["branch", "CC003"]
211+
```
212+
206213
## Outputs
207214

208215
### `result`
@@ -338,6 +345,49 @@ This needs commit-check 2.13.4 or newer, which reports `"status": "skip"` in
338345
its JSON. Against an older engine every check is `pass` or `fail` as before,
339346
and the report is unchanged.
340347

348+
### Warning Job Summary
349+
350+
A rule listed under the config's [top-level `warn`](#via-configuration-file)
351+
still runs and is reported in full — its own table row, its own entry in the
352+
details block — but it never fails the workflow. It counts toward "passed":
353+
354+
> **Commit Check**
355+
>
356+
> ✅ **3 of 4 checks passed**, 1 warning
357+
>
358+
> | Scope | Checked value | Warnings |
359+
> |---|---|---|
360+
> | Branch | `jsmith/fix-x` | [CC201 branch](https://commit-check.com/rules/#cc201) |
361+
>
362+
> <details>
363+
> <summary>Show all 4 checks</summary>
364+
>
365+
> ```text
366+
> Commit message
367+
> ✔ PR title (feat: add login page)
368+
> ✔ Commit 1/2 (feat: add login page)
369+
> Branch
370+
> ⚠ Branch (1 warning)
371+
> CC201 branch
372+
> value: jsmith/fix-x
373+
> The branch should follow Conventional Branch.
374+
> Suggest: Use <type>/<description> with allowed types
375+
> ```
376+
>
377+
> </details>
378+
>
379+
> _commit-check &lt;version&gt; · [Rules reference](https://commit-check.com/rules/)_
380+
381+
A warned scope is marked `⚠`, never `✖`, and a real failure elsewhere still
382+
fails the run — the verdict then reads `❌ **N of M checks failed**, K
383+
warnings` and both tables appear. In the step log, a warning becomes a
384+
`::warning` annotation rather than `::error`, so it never counts toward the
385+
run's error count.
386+
387+
This needs commit-check 2.17.0 or newer, which reports `"status": "warn"` in
388+
its JSON. Against an older engine, or a config with no `warn` list, no check
389+
can ever be a warning, and the report is unchanged.
390+
341391
## GitHub Pull Request Comments
342392

343393
With `pr-comments: true` the same report is posted as a pull request comment.

0 commit comments

Comments
 (0)