Skip to content

Commit aa4c4d3

Browse files
committed
Add helpful error message if incorrect repo permissions
1 parent bf3011c commit aa4c4d3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,17 @@ async def githubcallback(request):
257257
f"https://api.github.com/repos/{git_org}/{repo_name}/actions/secrets/public-key",
258258
headers=headers,
259259
).json()
260+
261+
# Check access
262+
try:
263+
if req["message"] == "Must have admin rights to Repository.":
264+
return HTMLResponse(
265+
"You must have admin rights to the Repository. Go to your repo settings and make sure you're an admin then try again.\nNote you may need to logout/log in again (or use incognito mode) to reset your session",
266+
status_code=403,
267+
)
268+
except Exception as e:
269+
log.error(f"Exception getting repo public key: {e}")
270+
260271
github_repo_public_key = req["key"]
261272
github_repo_public_key_id = req["key_id"]
262273

0 commit comments

Comments
 (0)