CircleCI-Public / orb-tools-orb

Various tools for authoring and publishing CircleCI orbs
https://circleci.com/orbs/registry/orb/circleci/orb-tools
MIT License
51 stars 75 forks source link

[semver:patch] Ensure `fail-if-semver-not-indicated` parameter set to `true` is honored #113

Closed yaningo closed 3 years ago

yaningo commented 3 years ago

Checklist

Motivation, issues

In the dev-promote-from-commit-subject command's definition, the function CheckIncrement relies on a conditional expression to decide whether or no to fail the build if the commit subject doesn't include a SemVer increment:

if [ "$SHOULD_FAIL" == "true" ];then
  exit 1

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

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

However, as the shell environment variable SHOULD_FAIL will only ever resolves to either:

or

the expression [ "$SHOULD_FAIL" == "true" ] will always return false, and therefore the fail-if-semver-not-indicated parameter set to true will never be honored.

Description

Modify the aforementioned conditional expression so it references the relevant value of the environment variable, and allows fail-if-semver-not-indicated set to true to be honored.

Fixes #112