Fix check

This commit is contained in:
ludeeus
2020-07-03 19:36:21 +02:00
parent 3745b161b1
commit 8d0c52aa78
+8 -11
View File
@@ -14,19 +14,16 @@ 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={},
)
async with GitHub(TOKEN) as github:
request = await github.client.get(
endpoint=f"/repos/{repo}/collaborators/{actor}/permission", headers={},
)
permission = request.get("permission", "read")
permission = request.get("permission", "read")
if permission in ["admin", "write"]:
print(f"{actor} is the owner of the repository")
return
except AIOGitHubAPIException as e:
exit(f"::error::{e}")
if permission in ["admin", "write"]:
print(f"{actor} is the owner of the repository")
return
exit(f"::error::{actor} does not have write access to the repository")