Skip to content

Commit 6f4eb2b

Browse files
authored
Merge pull request #278 from smoors/curl_api
use github API for downloading the diff
2 parents d17c46a + b8c3d48 commit 6f4eb2b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tasks/build.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,12 @@ def download_pr(repo_name, branch_name, pr, arch_job_dir):
343343
error_stage = _ERROR_GIT_CHECKOUT
344344
return checkout_output, checkout_err, checkout_exit_code, error_stage
345345

346-
curl_cmd = f'curl -L https://github.com/{repo_name}/pull/{pr.number}.diff > {pr.number}.diff'
346+
curl_cmd = ' '.join([
347+
'curl -L',
348+
'-H "Accept: application/vnd.github.diff"',
349+
'-H "X-GitHub-Api-Version: 2022-11-28"',
350+
f'https://api.github.com/repos/{repo_name}/pulls/{pr.number} > {pr.number}.diff',
351+
])
347352
log(f'curl with command {curl_cmd}')
348353
curl_output, curl_error, curl_exit_code = run_cmd(
349354
curl_cmd, "Obtain patch", arch_job_dir, raise_on_error=False

0 commit comments

Comments
 (0)