]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CI: github: enable github api authentication for OpenSSL tags read
authorIlya Shipitsin <chipitsine@gmail.com>
Thu, 22 Dec 2022 16:27:37 +0000 (22:27 +0600)
committerWilliam Lallemand <wlallemand@haproxy.org>
Thu, 22 Dec 2022 16:36:32 +0000 (17:36 +0100)
github api throttles requests with no auth, thus we can enable
GITHUB_API_TOKEN env variable. if not set, current behaviour is kept

.github/matrix.py

index ffc3414b95bbe980556d247bb72bc644b946d5b2..72e6b1a8524e46d974fb06265b312379a5a36b84 100755 (executable)
@@ -26,7 +26,9 @@ def clean_ssl(ssl):
     return ssl.replace("_VERSION", "").lower()
 
 def determine_latest_openssl(ssl):
-    openssl_tags = urllib.request.urlopen("https://api.github.com/repos/openssl/openssl/tags")
+    headers = {'Authorization': 'token ' + environ.get('GITHUB_API_TOKEN')} if environ.get('GITHUB_API_TOKEN') else {}
+    request = urllib.request.Request('https://api.github.com/repos/openssl/openssl/tags', headers=headers)
+    openssl_tags = urllib.request.urlopen(request)
     tags = json.loads(openssl_tags.read().decode('utf-8'))
     latest_tag = ''
     for tag in tags: