Skip to main content

GitHub action/workflow example that demonstrates how to continue on to the next step, if the previous step fails.

    - name: Install dependencies
      id: install-dependencies
      continue-on-error: true
      run: npm ci

    # If the above step fails, try clearing npm cache (has performance implications), and try again
    - name: Clear npm cache and install dependencies
      if: ${{ steps.install-dependencies.outcome == 'failure' && !cancelled() }}
      run: |
        npm cache clear --force
        npm ci

    - name: Do other stuff if step above succeeds...
      run: echo "doing other stuff..."