From c4b5aa197ba720ee2c34faf3577797dcb4ba0636 Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tomas.krizek@nic.cz>
Date: Wed, 3 Nov 2021 16:08:55 +0100
Subject: [PATCH] ci: allow extra sync time for macos GH action

---
 ci/gh_actions.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ci/gh_actions.py b/ci/gh_actions.py
index c452c69bb..8fe05b688 100755
--- a/ci/gh_actions.py
+++ b/ci/gh_actions.py
@@ -8,8 +8,9 @@ import requests
 
 
 BRANCH_API_ENDPOINT = "https://api.github.com/repos/CZ-NIC/knot-resolver/actions/runs?branch={branch}"  # noqa
-TIMEOUT = 15*60  # 15 mins max
+TIMEOUT = 20*60  # 20 mins max
 POLL_DELAY = 60
+SYNC_TIMEOUT = 10*60
 
 
 def exit(msg='', html_url='', code=1):
@@ -19,6 +20,7 @@ def exit(msg='', html_url='', code=1):
 
 
 end_time = time.time() + TIMEOUT
+sync_timeout = time.time() + SYNC_TIMEOUT
 while time.time() < end_time:
     response = requests.get(
         BRANCH_API_ENDPOINT.format(branch=sys.argv[1]),
@@ -37,6 +39,9 @@ while time.time() < end_time:
             continue
 
         if commit_sha != sys.argv[2]:
+            if time.time() < sync_timeout:
+                time.sleep(POLL_DELAY)
+                continue
             exit("Fetched invalid GH Action: commit mismatch. Re-run or push again?")
 
         if conclusion is None:
-- 
GitLab