diff --git a/.github/workflows/ci:test:deploy.yml b/.github/workflows/ci:test:deploy.yml index 04f7acf57..77f8f5397 100644 --- a/.github/workflows/ci:test:deploy.yml +++ b/.github/workflows/ci:test:deploy.yml @@ -4,7 +4,6 @@ on: push: branches: - main - pull_request: merge_group: workflow_run: workflows: @@ -33,6 +32,22 @@ jobs: - name: Checkout 🛎️ uses: actions/checkout@v4 + - name: Cancel job if triggering workflow was cancelled + if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'cancelled' + uses: actions/github-script@v7 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Cancelling because ci:build:image was cancelled" + echo "${GITHUB_TOKEN}" | gh auth login --with-token + gh run cancel "${GITHUB_RUN_ID}" + + echo "Waiting for cancellation..." + sleep 10 + + echo "Workflow cancellation timeout." + exit 1 + - name: Fail job if triggering workflow did not succeed if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' uses: actions/github-script@v7