Stop multiline GitHub action on first fail

Viewed 183

We have a GitHub action for building our app We're using the multiline syntax.

run: |
  npm install
  npm run test
  npm run e2e
  npm run deploy

If one on the commands fail, the action continue to the next command and will deploy the app.

Is there a way to abort the action on first fail?

1 Answers

You should try the "and" operator (&&):

run: |
  npm install &&
  npm run test &&
  npm run e2e &&
  npm run deploy
Related