From ff8db71cb54c47713b6829fede8939f185e4b68e Mon Sep 17 00:00:00 2001 From: rkuo-danswer Date: Sun, 29 Sep 2024 10:36:08 -0700 Subject: [PATCH] don't write a nightly tag to the same commit more than once (#2585) Co-authored-by: Richard Kuo --- .github/workflows/tag-nightly.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/tag-nightly.yml b/.github/workflows/tag-nightly.yml index 9b096d3e62d..bf2699d9fd4 100644 --- a/.github/workflows/tag-nightly.yml +++ b/.github/workflows/tag-nightly.yml @@ -25,7 +25,20 @@ jobs: git config user.name "Richard Kuo [bot]" git config user.email "rkuo[bot]@danswer.ai" + - name: Check for existing nightly tag + id: check_tag + run: | + if git tag --points-at HEAD --list "nightly-latest*" | grep -q .; then + echo "A tag starting with 'nightly-latest' already exists on HEAD." + echo "tag_exists=true" >> $GITHUB_OUTPUT + else + echo "No tag starting with 'nightly-latest' exists on HEAD." + echo "tag_exists=false" >> $GITHUB_OUTPUT + fi + + # don't tag again if HEAD already has a nightly-latest tag on it - name: Create Nightly Tag + if: steps.check_tag.outputs.tag_exists == 'false' env: DATE: ${{ github.run_id }} run: | @@ -34,6 +47,7 @@ jobs: git tag $TAG_NAME - name: Push Tag + if: steps.check_tag.outputs.tag_exists == 'false' run: | TAG_NAME="nightly-latest-$(date +'%Y%m%d')" git push origin $TAG_NAME