Retry reading HEAD commit
This commit is contained in:
parent
f6fb36c58a
commit
9687318b22
1 changed files with 7 additions and 2 deletions
|
|
@ -273,8 +273,13 @@ def patch(self, url: str, fail_msg: str, **data: Any) -> None:
|
|||
def update_nightly_description(self, release_id: int) -> None:
|
||||
url = f'{self.url_base}/{release_id}'
|
||||
now = str(datetime.datetime.utcnow()).split('.')[0] + ' UTC'
|
||||
with open('.git/refs/heads/master') as f:
|
||||
commit = f.read().strip()
|
||||
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()
|
||||
self.patch(
|
||||
url, 'Failed to update nightly release description',
|
||||
body=f'Nightly release, generated on: {now} from commit: {commit}.'
|
||||
|
|
|
|||
Loading…
Reference in a new issue