From 6c1861db4ffd86d11888e8deb418b443778f259e Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Wed, 13 Nov 2024 03:35:29 +0530 Subject: [PATCH] address the missing upstream VERSION case Address the case where the upstream VERSION file is missing, but present downstream. Signed-off-by: Pranshu Srivastava --- .github/workflows/merge-acm-flow.yaml | 4 +++- .github/workflows/merge-flow.yaml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge-acm-flow.yaml b/.github/workflows/merge-acm-flow.yaml index 66c5429..0916632 100644 --- a/.github/workflows/merge-acm-flow.yaml +++ b/.github/workflows/merge-acm-flow.yaml @@ -172,9 +172,11 @@ jobs: run: git merge --continue - name: Add VERSION file if not present run: | + is_version_file_present_upstream=$(git ls-tree ${{ steps.upstream.outputs.release }} | grep VERSION || true) # All tags use the vX.Y.Z format currently. version_from_tag=$(echo ${{ steps.upstream.outputs.release }} | sed -e "s/^v//") - if [ -f VERSION ]; then + # Perform check only if both remotes have the VERSION file. + if [ -n "$is_version_file_present_upstream" ] && [ -f VERSION ]; then version_from_file=$(cat VERSION) if [ "$version_from_tag" != "$version_from_file" ];then echo "::error:: tag version ${version_from_tag} doesn't correspond to version ${version_from_file} from VERSION file" diff --git a/.github/workflows/merge-flow.yaml b/.github/workflows/merge-flow.yaml index b6ab058..231c788 100644 --- a/.github/workflows/merge-flow.yaml +++ b/.github/workflows/merge-flow.yaml @@ -161,9 +161,11 @@ jobs: run: git merge --continue - name: Add VERSION file if not present run: | + is_version_file_present_upstream=$(git ls-tree ${{ steps.upstream.outputs.release }} | grep VERSION || true) # All tags use the vX.Y.Z format currently. version_from_tag=$(echo ${{ steps.upstream.outputs.release }} | sed -e "s/^v//") - if [ -f VERSION ]; then + # Perform check only if both remotes have the VERSION file. + if [ -n "$is_version_file_present_upstream" ] && [ -f VERSION ]; then version_from_file=$(cat VERSION) if [ "$version_from_tag" != "$version_from_file" ];then echo "::error:: tag version ${version_from_tag} doesn't correspond to version ${version_from_file} from VERSION file"