Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop further execution on error #117

Closed
sidvishnoi opened this issue Nov 17, 2021 · 3 comments · Fixed by #138
Closed

Stop further execution on error #117

sidvishnoi opened this issue Nov 17, 2021 · 3 comments · Fixed by #138
Labels
bug Something isn't working

Comments

@sidvishnoi
Copy link
Member

sidvishnoi commented Nov 17, 2021

When a step fails, the action still tries to run later steps. It should exit right away.

       [FATAL] Error: Errors found during processing.
          at run (/home/runner/work/_actions/w3c/spec-prod/v2/node_modules/respec/tools/respec2html.js:241:11)
          at processTicksAndRejections (node:internal/process/task_queues:96:5)
    Failed
  Error: Process completed with exit code 1.
  Error: w3c/spec-prod/v2/action.yml (Line: 107, Col: 24):
  Error: The template is not valid. w3c/spec-prod/v2/action.yml (Line: 107, Col: 24): Error reading JToken from JsonReader. Path '', line 0, position 0.
  Error: w3c/spec-prod/v2/action.yml (Line: 117, Col: 24):
  Error: The template is not valid. w3c/spec-prod/v2/action.yml (Line: 117, Col: 24): Error reading JToken from JsonReader. Path '', line 0, position 0.
  Error: w3c/spec-prod/v2/action.yml (Line: 127, Col: 24):
  Error: The template is not valid. w3c/spec-prod/v2/action.yml (Line: 127, Col: 24): Error reading JToken from JsonReader. Path '', line 0, position 0.
  Error: w3c/spec-prod/v2/action.yml (Line: 137, Col: 21):
  Error: The template is not valid. w3c/spec-prod/v2/action.yml (Line: 137, Col: 21): Error reading JToken from JsonReader. Path '', line 0, position 0.
  Error: w3c/spec-prod/v2/action.yml (Line: 147, Col: 24):
  Error: The template is not valid. w3c/spec-prod/v2/action.yml (Line: 147, Col: 24): Error reading JToken from JsonReader. Path '', line 0, position 0.

Ref: #116

@jyasskin
Copy link
Member

https://docs.github.com/en/actions/creating-actions/setting-exit-codes-for-actions makes it sound like the script is returning 0 ... and since the last line of each runs step is an echo command, that seems right?

@sidvishnoi
Copy link
Member Author

sidvishnoi commented Jan 12, 2022

As per line 5 of output in description, the process exited with code 1.
I think it might require manual use of if in each step to check previous step failure. IIRC, this started coming up when GitHub actions started supporting if in composite actions. I'll have to find some time to investigate.

Looking at sourcecode of setFailed, it's same as what we do but in different order.

@sidvishnoi
Copy link
Member Author

sidvishnoi commented Jan 12, 2022

since the last line of each runs step is an echo command, that seems right?

Hmm. Maybe. If yes, then a set -e in each step should stop step immediately.


Update: No. The action is running step with set -e already:

  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants