'Github actions failed last step on result of next step

I am preety sure its not possible but still wanna try my luck. I have deploy-dev step and smoke-test-dev. So if smoke test for dev fails then I want to fail the last step which is deploy-dev.

  deploy-dev:
    if: ${{ github.event.workflow_run.conclusion == 'skipped' && github.actor == 'dependabot[bot]' }}
    runs-on: ubuntu-latest
    needs: [lint, test]
    steps:
      - uses: actions/checkout@v2
      - name: Start deployment
        uses: bobheadxi/[email protected]
        id: deployment
        with:
          step: start
          token: ${{ secrets.GITHUB_TOKEN }}
          env: dev
      - name: Update deployment status
        uses: bobheadxi/[email protected]
        if: always()
        with:
          step: finish
          token: ${{ secrets.GITHUB_TOKEN }}
          status: ${{ job.status }}
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}

  smoke-tests-dev:
    if: ${{ github.event.workflow_run.conclusion == 'skipped' && github.actor == 'dependabot[bot]' }}
    runs-on: ubuntu-latest
    needs: deploy-dev
    steps:
      - uses: actions/checkout@v2
      - name: Checkout GitHub Action Repo
        uses: actions/checkout@v2
        with:
          repository: my/github-actions
          ref: ${{ env.COMMON_ACTIONS_VERSION }}
          token: ${{ secrets.REPO_READ_TOKEN }}
          path: ${{ env.COMMON_ACTIONS_PATH }}
      - name: install and smoke test
        uses: ./.github/common/actions/yarn
        with:
          npm_token: ${{ env.NPM_TOKEN }}
          env: dev
          action: test:smoke




Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source