Skip to content

Commit

Permalink
Merge pull request #204 from maxonfjvipon/fix-exists-without-comparison
Browse files Browse the repository at this point in the history
Fix "is_exists" without comparison
  • Loading branch information
yegor256 committed Dec 19, 2023
2 parents 93f18c2 + 6812b35 commit 7894af7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
5 changes: 2 additions & 3 deletions py/auto_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def pull_release(unique_deps):
data = response.json()
latest_release = data[0]
latest_version = latest_release["tag_name"]
if latest_version == version:
if compare(latest_version, version):
os.system(f'./pull.sh objectionary/{name}')
env_file = os.getenv('GITHUB_ENV')
eo_lib_version = f'{name}-{latest_version}'
Expand All @@ -22,7 +22,7 @@ def pull_release(unique_deps):
print(f'Added to env: {eo_lib_version}')
break
else:
print(f"Couldn't compare {latest_version} and {version}")
print(f"{latest_version} is less than or equal to {version}")

def compare(latest_version, old_version):
latest = latest_version.split(".")
Expand All @@ -32,5 +32,4 @@ def compare(latest_version, old_version):
return True
return False


pull_release(dependencies())
15 changes: 9 additions & 6 deletions py/is_branch_exist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
import subprocess
import sys

eo_lib_version = sys.argv[1]
print('cmd entry:', eo_lib_version)

command = f'git ls-remote --exit-code --heads origin update-{eo_lib_version}'
result = subprocess.run(command, shell=True, capture_output=True)
is_exist = result.returncode == 0
is_exist = False
if len(sys.argv) > 1:
eo_lib_version = sys.argv[1]
print('cmd entry:', eo_lib_version)
command = f'git ls-remote --exit-code --heads origin update-{eo_lib_version}'
result = subprocess.run(command, shell=True, capture_output=True)
is_exist = result.returncode == 0
else:
print(f"eo_lib_version was not set to sys.argv")
env_file = os.getenv('GITHUB_ENV')
with open(env_file, "a") as myfile:
myfile.write(f'is_exist={"true" if is_exist else "false"}')
Expand Down

0 comments on commit 7894af7

Please sign in to comment.