From 4754d21d7fdc12e001860f6a78e0ef64974fccf1 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 16 Nov 2023 11:04:52 -0500 Subject: [PATCH] Cancel workflow if no Milestone --- .github/workflows/spring-artifactory-release.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/spring-artifactory-release.yml b/.github/workflows/spring-artifactory-release.yml index 974e002..ce8bf8f 100644 --- a/.github/workflows/spring-artifactory-release.yml +++ b/.github/workflows/spring-artifactory-release.yml @@ -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