From ccf8a341be597077cd36ad33a72889a26b34083e Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Wed, 7 Aug 2024 12:39:06 +0200 Subject: [PATCH 1/4] Reduce window for finding a good commit - Only check last 100 commits. - Return the initial commit if no good one was found. Fixes #628 --- .github/workflows/sync-on-llvm-version.yml | 2 +- scripts/get-good-commit.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sync-on-llvm-version.yml b/.github/workflows/sync-on-llvm-version.yml index c2e404f6..42edcfc1 100644 --- a/.github/workflows/sync-on-llvm-version.yml +++ b/.github/workflows/sync-on-llvm-version.yml @@ -53,7 +53,7 @@ jobs: checkout-path: . github-project: llvm/llvm-project start-ref: main - max-tries: 500 + max-tries: 100 - name: "Generate snapshot version info" shell: bash -e {0} diff --git a/scripts/get-good-commit.py b/scripts/get-good-commit.py index 82d4cfa5..0f2d3e3d 100755 --- a/scripts/get-good-commit.py +++ b/scripts/get-good-commit.py @@ -62,12 +62,16 @@ def get_good_commit( logging.info(f"Found good commit: {commit_url}") return commit.sha - return "" + sha = repo.get_commit(sha=start_ref).sha + logging.info( + f"Not found a good commit, using the intial one: {start_ref}, aka {sha}" + ) + return {sha} def main(): parser = argparse.ArgumentParser( - description="Find the latest commit that passed tests" + description="Find the latest commit that passed tests or return the start-ref commit sha" ) parser.add_argument( "--token", @@ -115,8 +119,7 @@ def main(): required_checks=args.required_checks, max_tries=args.max_tries, ) - if sha == "": - sys.exit(-1) + print(sha) From ff682346e330259b6a94c1f70cfca77f5728d15b Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Wed, 7 Aug 2024 13:34:56 +0200 Subject: [PATCH 2/4] Update scripts/get-good-commit.py Co-authored-by: Nikita Popov --- scripts/get-good-commit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get-good-commit.py b/scripts/get-good-commit.py index 0f2d3e3d..f6b4714b 100755 --- a/scripts/get-good-commit.py +++ b/scripts/get-good-commit.py @@ -64,7 +64,7 @@ def get_good_commit( sha = repo.get_commit(sha=start_ref).sha logging.info( - f"Not found a good commit, using the intial one: {start_ref}, aka {sha}" + f"No good commit found, using the initial one: {start_ref}, aka {sha}" ) return {sha} From 535e0da30dc59ef2155f79d13aaaa00c2901abe0 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Wed, 7 Aug 2024 13:35:37 +0200 Subject: [PATCH 3/4] Update scripts/get-good-commit.py Co-authored-by: Nikita Popov --- scripts/get-good-commit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get-good-commit.py b/scripts/get-good-commit.py index f6b4714b..772c3675 100755 --- a/scripts/get-good-commit.py +++ b/scripts/get-good-commit.py @@ -66,7 +66,7 @@ def get_good_commit( logging.info( f"No good commit found, using the initial one: {start_ref}, aka {sha}" ) - return {sha} + return sha def main(): From 20bb962a97f37f10940b9abcd9788491385f9c5e Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Wed, 7 Aug 2024 14:37:30 +0200 Subject: [PATCH 4/4] Run pre-commit run -a --- scripts/get-good-commit.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/get-good-commit.py b/scripts/get-good-commit.py index 772c3675..e7097f3d 100755 --- a/scripts/get-good-commit.py +++ b/scripts/get-good-commit.py @@ -63,9 +63,7 @@ def get_good_commit( return commit.sha sha = repo.get_commit(sha=start_ref).sha - logging.info( - f"No good commit found, using the initial one: {start_ref}, aka {sha}" - ) + logging.info(f"No good commit found, using the initial one: {start_ref}, aka {sha}") return sha