Browse Source

Use git ls-remote instead of git tag -l for tag existence check

pull/25281/head
maliming 3 weeks ago
parent
commit
fc86247ce8
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 6
      .github/scripts/update_dependency_changes.py
  2. 6
      .github/workflows/nuget-packages-version-change-detector.yml

6
.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):

6
.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:

Loading…
Cancel
Save