-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: try two public urls for maintainer exists lint #2171
Conversation
@conda-forge/core this one is ready for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Ah, I was about to suggest that we don't need a GET here, a HEAD is enough: >>> requests.head("https://github.com/jaimergggggg").status_code
404
>>> requests.head("https://github.com/orgs/jaimergggggg/teams", allow_redirects=False).status_code
404
requests.head("https://github.com/jaimergp").status_code
200
>>> requests.head("https://github.com/orgs/jaimergp/teams", allow_redirects=False).status_code
404
requests.head("https://github.com/conda-forge").status_code
200
>>> requests.head("https://github.com/orgs/conda-forge/teams", allow_redirects=False).status_code
302 Note also that the org check returns 302, not 200. So the code should be: req_profile = requests.head(
f"https://github.com/{maintainer}",
allow_redirects=False,
)
is_user = req_profile.status_code == 200
req_org = requests.head(
f"https://github.com/orgs/{maintainer}/teams",
allow_redirects=False,
)
is_org = req_org.status_code in (200, 301, 302) # just to be safe |
cc @beckermr ^ |
I'll follow up with these improvements in another pr. |
Thank you! |
else: | ||
return ( | ||
requests.get( | ||
f"https://api.github.com/users/{maintainer}" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
except github.UnknownObjectException: | ||
return False | ||
return True |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
except github.UnknownObjectException: | ||
return False |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Checklist
news
entrypython conda_smithy/schema.py
)This PR fixes #2164 by using two public URLs to check if the maintainer exists instead of using the github API anonymously. Hopefully it is more robust since the anonymous API has pretty restructive rate limits.