Skip to content

fix: Publish stage always skipped due to boolean expression mismatch in publish pipeline#4093

Merged
Saadnajmi merged 1 commit intomicrosoft:mainfrom
Saadnajmi:fix-publish-pipeline-condition
Apr 24, 2026
Merged

fix: Publish stage always skipped due to boolean expression mismatch in publish pipeline#4093
Saadnajmi merged 1 commit intomicrosoft:mainfrom
Saadnajmi:fix-publish-pipeline-condition

Conversation

@Saadnajmi
Copy link
Copy Markdown
Collaborator

Problem

The Publish to NPM stage in azure-pipelines.publish.yml is always skipped, even when there are tarballs and skipNpmPublish is false.

Root Cause

The stage condition uses:

not(${{ parameters.skipNpmPublish }})

This mixes compile-time template expansion (${{ }}) with a runtime expression function (not()).

At compile time, ${{ parameters.skipNpmPublish }} expands to the YAML boolean string False (capital F). In Azure DevOps runtime expressions, False is not the boolean keyword false — it's a non-empty string, which is always truthy. So not(truthy)false, and the entire and(...) short-circuits to false.

This happens regardless of the parameter value — both True and False are non-empty strings, both truthy, both negated to false.

Fix

Replace not(${{ parameters.skipNpmPublish }}) with:

ne('${{ parameters.skipNpmPublish }}', 'true')

This uses ne() (not-equal) with a string comparison. Azure DevOps ne() is case-insensitive for strings, so:

Parameter value Expansion Comparison Result
false (default) ne('False', 'true') not equal true — stage runs
true ne('True', 'true') equal false — stage skipped

…ression mismatch

The condition `not(${{ parameters.skipNpmPublish }})` mixes compile-time
template expansion with runtime expression evaluation. At compile time,
${{ parameters.skipNpmPublish }} expands to the YAML boolean string 'False'
(capital F). In the Azure DevOps runtime expression context, 'False' is not
the boolean keyword false — it is a non-empty string, which is always truthy.
So not(truthy) evaluates to false, causing the Publish stage to be skipped
regardless of the parameter value.

Fix: use ne('${{ parameters.skipNpmPublish }}', 'true') which correctly
compares the expanded string using case-insensitive string comparison.
@Saadnajmi Saadnajmi force-pushed the fix-publish-pipeline-condition branch from baa56e1 to fe8b19f Compare April 24, 2026 20:11
@Saadnajmi Saadnajmi enabled auto-merge (squash) April 24, 2026 20:18
@Saadnajmi Saadnajmi merged commit d49b99b into microsoft:main Apr 24, 2026
14 checks passed
@Saadnajmi Saadnajmi deleted the fix-publish-pipeline-condition branch April 24, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants