diff --git a/publish.py b/publish.py index cae4b7381..12c60af14 100755 --- a/publish.py +++ b/publish.py @@ -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}.'