Skip to content

CICD-032 · Use step outcome for diagnostics ​

Encyclopedia · Variables, outputs and data flow · All snippets

Previous · CICD-031 · Next · CICD-033

1. Where it fits ​

  • Placement .github/workflows/ci.yml, under a job's steps.
  • Prerequisites GitHub Actions job or equivalent Gitea version with environment file support.
  • Platforms github-actions, gitea-actions.

2. Copy the snippet ​

yaml
if: ${{ !cancelled() && steps.tests.outcome == 'failure' }}
run: test -s reports/junit.xml

3. How it works ​

The outcome field describes the test step before continue-on-error affects its conclusion. This guard runs only when that step failed and the workflow has not been cancelled.

Artifact collection depends on the raw outcome of the test step.

flowchart TD
  N1["Test step"]
  N2{"Failed and not cancelled"}
  N1 --> N2
  N3["Collect report"]
  N2 -->|Yes| N3
  N4["Skip collection"]
  N2 -->|No| N4

4. Verify the result ​

Set the producer ID to tests. outcome reports pre-continue-on-error status.

Validation syntax-validated (YAML parse). Status definitions.