fix: use prior tag before target version when version tag exists
This commit is contained in:
1 parent
e188bd69ba
commit
7867db3f2a
2 files changed
+21
-7
No files matched your search
+9
-3
@@ -109,11 +109,17 @@ save_file = os.environ.get("INPUT_SAVE_TO_FILE", "")
|
||||
subprocess.run(["git", "fetch", "--tags", "--prune"], capture_output=True)
|
||||
|
||||
if not from_ref:
|
||||
code, out = subprocess.run(["git", "describe", "--tags", f"--match={tag_pattern}", "--exact-match", to_ref], capture_output=True, text=True).returncode, ""
|
||||
if code == 0:
|
||||
res = subprocess.run(["git", "describe", "--tags", f"--match={tag_pattern}", "--abbrev=0", f"{to_ref}^"], capture_output=True, text=True)
|
||||
if version:
|
||||
target_tag = version if version.startswith("v") else f"v{version}"
|
||||
res = subprocess.run(["git", "describe", "--tags", f"--match={tag_pattern}", "--abbrev=0", f"{target_tag}^"], capture_output=True, text=True)
|
||||
if res.returncode == 0 and res.stdout.strip():
|
||||
from_ref = res.stdout.strip()
|
||||
if not from_ref:
|
||||
code, out = subprocess.run(["git", "describe", "--tags", f"--match={tag_pattern}", "--exact-match", to_ref], capture_output=True, text=True).returncode, ""
|
||||
if code == 0:
|
||||
res = subprocess.run(["git", "describe", "--tags", f"--match={tag_pattern}", "--abbrev=0", f"{to_ref}^"], capture_output=True, text=True)
|
||||
if res.returncode == 0 and res.stdout.strip():
|
||||
from_ref = res.stdout.strip()
|
||||
if not from_ref:
|
||||
res = subprocess.run(["git", "describe", "--tags", f"--match={tag_pattern}", "--abbrev=0", to_ref], capture_output=True, text=True)
|
||||
if res.returncode == 0 and res.stdout.strip():
|
||||
|
||||
Reference in new issue
Block a user