-1

I have this step in a yaml workflow file:

- name: run the update_docs scripts
  run: bash ./docs/update_docs.sh

When the workflow runs on the github server, the "Actions" tab provides me this output for this step:

Run bash ./docs/update_docs.sh
./docs/update_docs.sh: line 2: pdoc: command not found
mv: cannot stat './docs/folder/*': No such file or directory

Yet the step (and the whole workflow) is marked as successful.

  • I tried to add a "fail-fast" strategy without success
  • the string "continue-on-error" is not contained in the file

How to get the workflow to not pass on such error ?

Vince
  • 3,979
  • 10
  • 41
  • 69
  • 1
    Do you have any error handling in the script itself? Please add the first few lines of your script in your question and this relevant part which fails. Also, isn't the script itself executable? If it is, you can directly run it i.e. `run: ./docs/update_docs.sh`. – Azeem May 11 '23 at 13:52
  • 1
    If you put `set -e` in the script, it will terminate as soon as any command inside it fails (i.e. as soon as any command returns a nonzero status). Once the script fails, the step with fail as well. (More information regarding returning errors on script execution can be found [here](https://stackoverflow.com/questions/4381618/exit-a-script-on-error)) – GuiFalourd May 12 '23 at 11:01

1 Answers1

0

if the content of the bash file is for example:

imaginary command
ls -alh

the first line fails, but the second succeed, and this results in the workflow step being successful.

On this other hand, if set -e is added (see: Stop on first error):

set -e
imaginary command
ls -alh

the script exits at the first error, and therefore the scripts exit with error and the workflow test fails.

Vince
  • 3,979
  • 10
  • 41
  • 69