Use git rev-parse to get nightly commit hash
This commit is contained in:
parent
fca0999814
commit
053cede581
@ -269,13 +269,7 @@ class GitHub(Base): # {{{
|
||||
def update_nightly_description(self, release_id: int) -> None:
|
||||
url = f'{self.url_base}/{release_id}'
|
||||
now = str(datetime.datetime.utcnow()).split('.')[0] + ' UTC'
|
||||
try:
|
||||
with open('.git/refs/heads/master') as f:
|
||||
commit = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
time.sleep(1)
|
||||
with open('.git/refs/heads/master') as f:
|
||||
commit = f.read().strip()
|
||||
commit = subprocess.check_output(['git', 'rev-parse', '--verify', '--end-of-options', 'master^{commit}']).decode('utf-8').strip()
|
||||
self.patch(
|
||||
url, 'Failed to update nightly release description',
|
||||
body=f'Nightly release, generated on: {now} from commit: {commit}.'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user