From 662776edc6fcc883fe7105240715989c8fdc4833 Mon Sep 17 00:00:00 2001 From: Max Lobur Date: Thu, 1 Jun 2023 17:59:05 +0300 Subject: [PATCH] Do not release a duplicate for the same hash (#57) * Do not release a duplicate for the same hash * Do not release a duplicate for the same hash * update * update * update --- .github/workflows/controller-release.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/controller-release.yml b/.github/workflows/controller-release.yml index 56c51b9..78912e9 100644 --- a/.github/workflows/controller-release.yml +++ b/.github/workflows/controller-release.yml @@ -62,6 +62,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Fetch pull request for the given ref id: get-pull-request @@ -69,7 +71,19 @@ jobs: with: sha: ${{ inputs.sha }} + - name: Check duplicate + id: check-duplicate + run: | + latest_hash=$(git rev-parse ${{ github.ref_name }}) + tags=$(git tag --contains "$latest_hash") + if [[ -n $tags ]]; then + echo "duplicate=true" >> "$GITHUB_OUTPUT" + else + echo "duplicate=false" >> "$GITHUB_OUTPUT" + fi + - name: Do release + if: steps.check-duplicate.outputs.duplicate == 'false' id: release uses: release-drafter/release-drafter@v5 with: @@ -80,6 +94,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.github_access_token || secrets.GITHUB_TOKEN }} - name: Verify release # Workaround for https://github.com/release-drafter/release-drafter/issues/1313 + if: steps.check-duplicate.outputs.duplicate == 'false' shell: bash run: | echo 'Checking release id not empty: "${{ steps.release.outputs.id }}"'