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:
|
def update_nightly_description(self, release_id: int) -> None:
|
||||||
url = f'{self.url_base}/{release_id}'
|
url = f'{self.url_base}/{release_id}'
|
||||||
now = str(datetime.datetime.utcnow()).split('.')[0] + ' UTC'
|
now = str(datetime.datetime.utcnow()).split('.')[0] + ' UTC'
|
||||||
try:
|
commit = subprocess.check_output(['git', 'rev-parse', '--verify', '--end-of-options', 'master^{commit}']).decode('utf-8').strip()
|
||||||
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()
|
|
||||||
self.patch(
|
self.patch(
|
||||||
url, 'Failed to update nightly release description',
|
url, 'Failed to update nightly release description',
|
||||||
body=f'Nightly release, generated on: {now} from commit: {commit}.'
|
body=f'Nightly release, generated on: {now} from commit: {commit}.'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user