I attached a patch. It keeps current behaviour and is safe to apply.

in order to make a difference, github token must be issued and set via
github ci settings.

Ilya

чт, 22 дек. 2022 г. в 16:57, Willy Tarreau <w...@1wt.eu>:

> On Thu, Dec 22, 2022 at 04:47:09PM +0600, ???? ??????? wrote:
> > what if I make it conditional, i.e. if github token is defined via env,
> > make non anonymous api call,
>
> I'm sorry, Ilya, but I have no idea what this means :-)
>
> Willy
>
From c4e038b014c3c8e565857bc971d200b091192d93 Mon Sep 17 00:00:00 2001
From: Ilya Shipitsin <chipits...@gmail.com>
Date: Thu, 22 Dec 2022 22:27:37 +0600
Subject: [PATCH] CI: enable github api authentication for OpenSSL tags read

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.github/matrix.py b/.github/matrix.py
index ffc3414b9..72e6b1a85 100755
--- a/.github/matrix.py
+++ b/.github/matrix.py
@@ -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:
-- 
2.38.1

Reply via email to