From 6cc5bfe70e3907eb5d22e4afb296fbb975a31e86 Mon Sep 17 00:00:00 2001 From: Shwetha Gururaj Date: Thu, 23 May 2024 21:54:37 -0400 Subject: [PATCH] Add version check to CLAW update [v7] (#2908) * Add version check to CLAW update * Expand command flag --- .../workflows/release-build-sign-upload.yml | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-build-sign-upload.yml b/.github/workflows/release-build-sign-upload.yml index ccfb5856649..754de9566d6 100644 --- a/.github/workflows/release-build-sign-upload.yml +++ b/.github/workflows/release-build-sign-upload.yml @@ -1067,7 +1067,7 @@ jobs: uses: actions/checkout@v4 with: repository: cloudfoundry/CLAW - ref: develop + ref: master path: CLAW ssh-key: ${{ secrets.GIT_SSH_KEY_CLAW }} @@ -1076,18 +1076,23 @@ jobs: set -ex pushd CLAW - echo "- ${VERSION_BUILD}" >> claw-variables.yml - - git add claw-variables.yml - - if ! [ -z "$(git status --porcelain)"]; then - git config user.name github-actions - git config user.email github-actions@github.com - git commit -m "Add CF CLI ${VERSION_BUILD}" + if grep --quiet "${VERSION_BUILD}" "claw-variables.yml" ; then + echo 'Version already exists in CLAW.' + exit 1 else - echo "no new version to commit" + echo "- ${VERSION_BUILD}" >> claw-variables.yml + + git add claw-variables.yml + + if ! [ -z "$(git status --porcelain)"]; then + git config user.name github-actions + git config user.email github-actions@github.com + git commit -m "Add CF CLI ${VERSION_BUILD}" + else + echo "no new version to commit" + fi + + git push fi - - git push popd # vim: set sw=2 ts=2 sts=2 et tw=78 foldlevel=2 fdm=indent nospell: