msys2 / msys2-autobuild

🏭🏭🏭🏭🏭🏭🏭🏭
https://packages.msys2.org/queue
MIT License
35 stars 25 forks source link

[Feature request] Don't require github credentials for fetch-assets #20

Closed jeremyd2019 closed 3 years ago

jeremyd2019 commented 3 years ago

autobuild.py fetch-assets works perfectly well without github credentials, but the script requires either GITHUB_TOKEN or GITHUB_USER/GITHUB_PASS environment variables to be set. Rather than deal with credentials, I use the following stupid hack:

diff --git a/autobuild.py b/autobuild.py
index 2df03ba..55acaeb 100644
--- a/autobuild.py
+++ b/autobuild.py
@@ -750,7 +750,8 @@ def get_credentials() -> Dict[str, Any]:
     elif "GITHUB_USER" in environ and "GITHUB_PASS" in environ:
         return {'login_or_token': environ["GITHUB_USER"], 'password': environ["GITHUB_PASS"]}
     else:
-        raise Exception("'GITHUB_TOKEN' or 'GITHUB_USER'/'GITHUB_PASS' env vars not set")
+        return {}
+        #raise Exception("'GITHUB_TOKEN' or 'GITHUB_USER'/'GITHUB_PASS' env vars not set")

 def get_repo() -> Repository:

It would be nice if it knew not to require credentials for operations that can be done unauthenticated.

lazka commented 3 years ago

There is a 60 API calls / hour rate limit for anonymous requests, which isn't much. So we probably have to catch those errors an suggest setting GITHUB_TOKEN etc..

jeremyd2019 commented 3 years ago

I haven't hit any error like that, but I do get fairly frequent timeout errors and have to restart the command. I don't know if that's related to an anonymous request limit or just my internet connection though.