Fix check

This commit is contained in:
ludeeus
2020-07-03 19:48:57 +02:00
parent 8d0c52aa78
commit f40fa32164
+5 -1
View File
@@ -14,9 +14,11 @@ async def check():
event = get_event()
actor = event["pull_request"]["user"]["login"]
try:
async with GitHub(TOKEN) as github:
request = await github.client.get(
endpoint=f"/repos/{repo}/collaborators/{actor}/permission", headers={},
endpoint=f"/repos/{repo}/collaborators/{actor}/permission",
headers=None,
)
permission = request.get("permission", "read")
@@ -24,6 +26,8 @@ async def check():
if permission in ["admin", "write"]:
print(f"{actor} is the owner of the repository")
return
except AIOGitHubAPIException as e:
exit(f"::error::{e}")
exit(f"::error::{actor} does not have write access to the repository")