From fc86247ce8a3b78a2d76dc29bf41d404c7ab8184 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 16 Apr 2026 15:17:56 +0900 Subject: [PATCH] Use git ls-remote instead of git tag -l for tag existence check --- .github/scripts/update_dependency_changes.py | 6 +++--- .../workflows/nuget-packages-version-change-detector.yml | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/scripts/update_dependency_changes.py b/.github/scripts/update_dependency_changes.py index 02ab623ff8..060e945486 100644 --- a/.github/scripts/update_dependency_changes.py +++ b/.github/scripts/update_dependency_changes.py @@ -26,13 +26,13 @@ def normalize_version(version): def check_tag_exists(tag): - """Check if a git tag exists.""" + """Check if a git tag exists on the remote.""" result = subprocess.run( - ["git", "tag", "-l", tag], + ["git", "ls-remote", "--tags", "origin", tag], capture_output=True, text=True, ) - return result.returncode == 0 and tag in result.stdout.strip().split("\n") + return result.returncode == 0 and result.stdout.strip() != "" def bump_patch_if_released(version, tag_exists_fn=None): diff --git a/.github/workflows/nuget-packages-version-change-detector.yml b/.github/workflows/nuget-packages-version-change-detector.yml index 4ed7fad8de..45dba3332b 100644 --- a/.github/workflows/nuget-packages-version-change-detector.yml +++ b/.github/workflows/nuget-packages-version-change-detector.yml @@ -44,10 +44,8 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 1 - - name: Fetch base branch and tags - run: | - git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} --depth=1 - git fetch --tags origin + - name: Fetch base branch + run: git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} --depth=1 - uses: actions/setup-python@v5 with: