Setting fail-if-semver-not-indicated to true don't fail the build

I have a public orb.
In the config.yml file i set fail-if-semver-not-indicated parameter to true but even when not supplying with semver in the commit the build passes.

When looking at the job run i can even see that semver was not detected:
Commit subject: change readme. Commit subject did not indicate which SemVer increment to make. To publish orb, you can ammend the commit or push another commit with [semver:FOO] in the subject where FOO is major, minor, patch. Note: To indicate intention to skip promotion, include [semver:skip] in the commit subject instead.
CircleCI received exit code 0

This is the relevant config part:
integration-test_deploy:
when: << pipeline.parameters.run-integration-tests >>
jobs:
- orb-tools/dev-promote-prod-from-commit-subject:
orb-name: ridehip/hip-orb
context: orb-publishing
add-pr-comment: false
fail-if-semver-not-indicated: true
publish-version-tag: false
filters:
branches:
only:
- main

Hi @jonzakhip! Welcome to the CircleCI Discuss community!

I created a GitHub issue in the orb’s repository so our Community & Partner Engineering team can look into this.

I suspect the issue stems from the expression [ "$SHOULD_FAIL" == "true" ] being tested in this part of the orb’s code:

CheckIncrement() {
    if [ -z "${SEMVER_INCREMENT}" ];then
        echo "Commit subject did not indicate which SemVer increment to make."
        echo "To publish orb, you can ammend the commit or push another commit with [semver:FOO] in the subject where FOO is major, minor, patch."
        echo "Note: To indicate intention to skip promotion, include [semver:skip] in the commit subject instead."
        if [ "$SHOULD_FAIL" == "true" ];then
            exit 1
        else
            echo "export PR_MESSAGE=\"BotComment: Orb publish was skipped due to [semver:patch|minor|major] not being included in commit message.\""  >> "$BASH_ENV"
        fi
    elif [ "$SEMVER_INCREMENT" == "skip" ];then
        echo "SEMVER in commit indicated to skip orb release"
        echo "export PR_MESSAGE=\"BotComment: Orb publish was skipped due to [semver:skip] in commit message.\""  >> "$BASH_ENV"
    else
        PublishOrb
        echo "export PR_MESSAGE=\"BotComment: *Production* version of orb available for use - \\\`${ORB_VERSION}\\\`\"" >> "$BASH_ENV"
    fi
}

 
SHOULD_FAIL is defined as an environment variable of the related step:

SHOULD_FAIL: <<parameters.fail-if-semver-not-indicated>>

However, though fail-if-semver-not-indicated will either be true or false, the SHOULD_FAIL shell variable will only ever resolve to 1 or 0, so "$SHOULD_FAIL" == "true" will never happen, hence fail-if-semver-not-indicated's value not being honored.

Hello again @jonzakhip,

Based on the above observation, I created a pull-request for our Community & Partner Engineering team to review, and -if deemed valid- to merge.

Hi @jonzakhip,

I’m happy to confirm that the above pull-request has been merged.

Please make sure to use the latest version of the Orb Tools orb (10.0.4).

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.