release: Fix result check for cancelled workflows (#44017)

If the entire workflow was cancelled we also need to check for
`cancelled()`. Simply checking needs.*.result is not sufficient - it was
observed that the success branch was still entered when only checking
needs.

Testing: Tested manually, by cancelling [this
workflow](https://github.com/servo/servo/actions/runs/24119740924/job/70371050119)
which resulted in a draft release publish (failure branch)

---------

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
This commit is contained in:
Jonathan Schwender
2026-04-08 07:58:58 +02:00
committed by GitHub
parent cff186777c
commit 0ea14d1b60

View File

@@ -68,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Publish as latest (success)
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
if: ${{ !contains(needs.*.result, 'failure') && (!contains(needs.*.result, 'cancelled') && !cancelled()) }}
run: |
gh api \
--method PATCH \
@@ -77,7 +77,7 @@ jobs:
/repos/${RELEASE_REPO}/releases/${RELEASE_ID} \
-F draft=false
- name: Publish as latest (failure)
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
if: ${{ contains(needs.*.result, 'failure') || (contains(needs.*.result, 'cancelled') || cancelled()) }}
run: |
gh api \
--method PATCH \