Cancel workflow if no Milestone

This commit is contained in:
Artem Bilan
2023-11-16 11:04:52 -05:00
parent aa5fa0316a
commit 4754d21d7f

View File

@@ -34,12 +34,14 @@ jobs:
fi
export CANDIDATE_VERSION=${CURRENT_VERSION/-SNAPSHOT}
RELEASE_VERSION=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq 'map(select(.title | startswith(env.CANDIDATE_VERSION))) | .[0] | .title')
if [ -z $RELEASE_VERSION ]; then
echo "::error::No scheduled milestone for $CURRENT_VERSION version."
exit 1
if [ -z $RELEASE_VERSION ]
then
gh run cancel ${{ github.run_id }}
echo "::warning title=Nothing to release::No scheduled milestone for $CURRENT_VERSION version"
else
echo releaseVersion=$RELEASE_VERSION >> $GITHUB_OUTPUT
echo "::notice title=RELEASE VERSION::$RELEASE_VERSION"
fi
echo releaseVersion=$RELEASE_VERSION >> $GITHUB_OUTPUT
echo "::notice title=RELEASE VERSION::$RELEASE_VERSION"
staging:
needs: releaseVersion