Skip to content

Commit 886cd8e

Browse files
shenxianpengclaude
andcommitted
fix: wire the result output through action.yml
The output was declared with only a description, and the step that produces it had no id. Composite actions do not forward step outputs automatically, so steps.<id>.outputs.result resolved to the empty string and the fromJSON call in the README documentation would have failed the calling workflow. The Python side was already writing the payload to $GITHUB_OUTPUT correctly; the mapping above it was missing. The unit tests could not catch this — they exercise set_result_output, not the action.yml plumbing around it. Also notes in the README that a downstream step reading the result needs dry-run or continue-on-error, since a failing check otherwise ends the job before that step runs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn
1 parent c63ebfd commit 886cd8e

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,19 @@ Structured check results as JSON, available to downstream steps via
211211
```yaml
212212
- uses: commit-check/commit-check-action@v2
213213
id: commit-check
214+
with:
215+
dry-run: true # (1)
214216
215217
- name: Inspect results
216218
run: |
217219
echo "Status: ${{ fromJSON(steps.commit-check.outputs.result).status }}"
218220
echo "Scopes: ${{ toJSON(fromJSON(steps.commit-check.outputs.result).scopes) }}"
219221
```
220222

223+
1. Without `dry-run`, a failing check ends the job before any later step runs.
224+
Use `dry-run` (or `continue-on-error`) when a downstream step is meant to
225+
read the result and decide for itself.
226+
221227
Each scope carries the check outcomes (`rule_id`, `check`, `status`, `value`,
222228
`error`, `suggest`, `docs_url`) exactly as produced by
223229
`commit-check --format json`, so downstream jobs can build their own reports

‎action.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,16 @@ inputs:
4040
outputs:
4141
result:
4242
description: Structured check results as JSON (status + per-scope checks). Consume with fromJSON(steps.<id>.outputs.result).
43+
# Composite actions do not forward step outputs automatically: without this
44+
# mapping (and the step id it refers to) the output is always the empty
45+
# string, and fromJSON('') fails the calling workflow.
46+
value: ${{ steps.commit-check.outputs.result }}
4347

4448
runs:
4549
using: "composite"
4650
steps:
4751
- name: Install dependencies and run commit-check
52+
id: commit-check
4853
shell: bash
4954
run: |
5055
# Platform-specific settings

0 commit comments

Comments
 (0)