Skip to content

Commit 1e97f1b

Browse files
EmilyBourneyguclu
andauthored
Fix comment bot (pyccel#1865)
The comment bot is broken because the authentification test is slightly wrong. For several tests the authentification is carried out in a separate stage which adds `installation_token` to the environment as a variable. This PR fixes the logic so this value is collected if it is available Co-authored-by: Yaman Güçlü <[email protected]>
1 parent b3423a6 commit 1e97f1b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ci_tools/bot_tools/github_api_interactions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ class GitHubAPIInteractions:
6868
def __init__(self):
6969
repo = os.environ["GITHUB_REPOSITORY"]
7070
self._org, self._repo = repo.split('/')
71-
if "PEM" in os.environ:
71+
if "installation_token" in os.environ:
7272
self._authenticated = True
73-
if "installation_token" in os.environ:
74-
self._install_token = os.environ["installation_token"]
75-
self._install_token_exp = time.strptime(os.environ["installation_token_exp"], "%Y-%m-%dT%H:%M:%SZ")
76-
else:
77-
self._install_token, expiry = get_authorization()
78-
self._install_token_exp = time.strptime(expiry, "%Y-%m-%dT%H:%M:%SZ")
73+
self._install_token = os.environ["installation_token"]
74+
self._install_token_exp = time.strptime(os.environ["installation_token_exp"], "%Y-%m-%dT%H:%M:%SZ")
75+
elif "PEM" in os.environ:
76+
self._authenticated = True
77+
self._install_token, expiry = get_authorization()
78+
self._install_token_exp = time.strptime(expiry, "%Y-%m-%dT%H:%M:%SZ")
7979
else:
8080
self._authenticated = False
8181

0 commit comments

Comments
 (0)