Skip to content

Commit

Permalink
Always use short hash
Browse files Browse the repository at this point in the history
  • Loading branch information
oseiler2 committed Jun 2, 2023
1 parent e831c34 commit 5e05d84
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions git-rev.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
branch = m.group(2)
tag = "latest"

# get current revision hash
GITHUB_SHA = os.environ.get('GITHUB_SHA')
if GITHUB_SHA is not None:
commit = GITHUB_SHA

else:
# running locally

Expand All @@ -49,14 +44,14 @@
except:
branch = "unknown"

# get current revision hash
try:
commit = subprocess.check_output("git log --pretty=format:%h -n 1", shell=True).decode().strip()
except:
commit = "?"

version = tag

# get current revision hash
try:
commit = subprocess.check_output("git log --pretty=format:%h -n 1", shell=True).decode().strip()
except:
commit = "?"

# if not main branch append branch name
if branch != "main" and branch != "HEAD":
version += "-[" + branch + "]"
Expand Down

0 comments on commit 5e05d84

Please sign in to comment.