From 47763f58030cb1a10e92b71649165d6d832a185c Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Mon, 17 Mar 2025 10:49:37 +0100 Subject: [PATCH] when we are done processing the repo, we check it out to the main/master branch --- pull_requests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pull_requests.py b/pull_requests.py index 765113e..d2a2e5a 100644 --- a/pull_requests.py +++ b/pull_requests.py @@ -70,6 +70,10 @@ def ensure_full_history(repo_path: str) -> None: if result.stdout.strip() == "true": run_git_cmd(["fetch", "--unshallow"], repo_path) +def reset_repo_to_latest_commit(repo_path: str) -> None: + current_branch = run_git_cmd(["rev-parse", "--abbrev-ref", "HEAD"], repo_path).stdout.strip() + run_git_cmd(["checkout", current_branch], repo_path) + def process_pull(repo: Repository, pr: PullRequest, dataset: Dataset, repos_dir: str): commits = list(pr.get_commits()) if not commits: @@ -144,6 +148,7 @@ def process_pull(repo: Repository, pr: PullRequest, dataset: Dataset, repos_dir: entry.metadata.successful = False finally: build_handler.clean_repo() + reset_repo_to_latest_commit(repo_path) dataset.to_json(args.output)