Skip to content

Commit f5c517a

Browse files
committed
Fix create-release job condition to properly handle skipped publish jobs
The previous condition had two issues: 1. `always()` was incorrectly placed after the changes_made check, making it ineffective 2. The condition was overly verbose with explicit OR checks for all combinations This fix: - Moves `always()` to the beginning so the condition evaluates even when publish jobs are skipped - Simplifies the logic to check if at least one publish job succeeded - Adds documentation explaining why always() is needed Without `always()` at the start, the job would never run when dependencies are skipped, and the result checks would never be evaluated.
1 parent e545918 commit f5c517a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ jobs:
193193

194194
create-release:
195195
needs: [update-packages, create-metadata, publish-pypi, publish-npm]
196+
# create release when we've published a new version to npm or pypi
197+
# always() is needed to evaluate this condition even when dependency jobs are skipped
198+
# See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif
196199
if: |
197-
(needs.update-packages.outputs.changes_made == 'true' && always()) &&
198-
((needs.publish-pypi.result == 'success' && needs.publish-npm.result == 'skipped') ||
199-
(needs.publish-pypi.result == 'skipped' && needs.publish-npm.result == 'success') ||
200-
(needs.publish-pypi.result == 'success' && needs.publish-npm.result == 'success'))
200+
always() &&
201+
needs.update-packages.outputs.changes_made == 'true' &&
202+
(needs.publish-pypi.result == 'success' || needs.publish-npm.result == 'success')
201203
runs-on: ubuntu-latest
202204
environment: release
203205
permissions:

0 commit comments

Comments
 (0)