Skip to content

Commit fce140b

Browse files
committed
correctly use github_api_get_request in fetch_files_from_commit
1 parent 22d90f4 commit fce140b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

easybuild/tools/github.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,13 +712,13 @@ def fetch_files_from_commit(commit, files=None, path=None, github_account=None,
712712
if not files:
713713
github_user = build_option('github_user')
714714

715-
def pr_request_fn(gh):
716-
return gh.repos[github_account][github_repo].pulls[pr]
715+
def commit_request_fn(gh):
716+
return gh.repos[github_account][github_repo].commits[commit]
717717

718718
# see also https://docs.github.com/en/rest/commits/commits#get-a-commit,
719719
# in particular part about media types
720720
accept_diff = {'Accept': 'application/vnd.github.diff'}
721-
status, data = github_api_get_request(pr_request_fn, github_user=github_user, headers=accept_diff)
721+
status, data = github_api_get_request(commit_request_fn, github_user=github_user, headers=accept_diff)
722722
if status == HTTP_STATUS_OK:
723723
# decode from bytes to text
724724
diff_txt = data.decode()
@@ -727,7 +727,8 @@ def pr_request_fn(gh):
727727
files = det_patched_files(txt=diff_txt, omit_ab_prefix=True, github=True, filter_deleted=True)
728728
_log.debug("List of patched files for commit %s: %s", commit, files)
729729
else:
730-
error_msg = f"Failed to download diff for {github_account}/{github_repo} PR #{pr}! (HTTP status code: {status})"
730+
error_msg = f"Failed to download diff for {github_account}/{github_repo} PR #{pr}! "
731+
error_msg += f"(HTTP status code: {status})"
731732
raise EasyBuildError(error_msg)
732733

733734
# download tarball for specific commit

0 commit comments

Comments
 (0)