From b8c3d48b4e696cb8a5a7c7078bdb356af8940f6e Mon Sep 17 00:00:00 2001 From: sam Date: Sun, 8 Sep 2024 16:57:47 +0200 Subject: [PATCH] use github API for downloading the diff --- tasks/build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasks/build.py b/tasks/build.py index a967ef7..0bcd853 100644 --- a/tasks/build.py +++ b/tasks/build.py @@ -343,7 +343,12 @@ def download_pr(repo_name, branch_name, pr, arch_job_dir): error_stage = _ERROR_GIT_CHECKOUT return checkout_output, checkout_err, checkout_exit_code, error_stage - curl_cmd = f'curl -L https://github.com/{repo_name}/pull/{pr.number}.diff > {pr.number}.diff' + curl_cmd = ' '.join([ + 'curl -L', + '-H "Accept: application/vnd.github.diff"', + '-H "X-GitHub-Api-Version: 2022-11-28"', + f'https://api.github.com/repos/{repo_name}/pulls/{pr.number} > {pr.number}.diff', + ]) log(f'curl with command {curl_cmd}') curl_output, curl_error, curl_exit_code = run_cmd( curl_cmd, "Obtain patch", arch_job_dir, raise_on_error=False