Skip to content

Commit 9a32adc

Browse files
authored
Merge pull request #115 from Nerixyz/fix/pr-stuff
fix: artifact download
2 parents 4923dc7 + 0b130f2 commit 9a32adc

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

post/clang_tidy_review/clang_tidy_review/__init__.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
from github.Requester import Requester
2727
from github.PaginatedList import PaginatedList
2828
from github.WorkflowRun import WorkflowRun
29-
from typing import List, Optional, TypedDict
29+
from github.Artifact import Artifact
30+
from typing import Any, List, Optional, TypedDict
3031

3132
DIFF_HEADER_LINE_LENGTH = 5
3233
FIXES_FILE = "clang_tidy_review.yaml"
@@ -353,6 +354,16 @@ def post_annotations(self, review):
353354
"POST", url, parameters=review, headers=headers
354355
)
355356

357+
def download_json_artifact(self, artifact: Artifact) -> Any:
358+
headers = {
359+
"Accept": "application/vnd.github+json",
360+
"Authorization": f"Bearer {self.token}",
361+
}
362+
_, data = self.repo._requester.requestJsonAndCheck(
363+
"GET", artifact.archive_download_url, headers=headers
364+
)
365+
return data
366+
356367

357368
@contextlib.contextmanager
358369
def message_group(title: str):
@@ -925,9 +936,7 @@ def download_artifacts(pull: PullRequest, workflow_id: int):
925936
return None, None
926937

927938
try:
928-
_, data = pull.repo._requester.requestJsonAndCheck(
929-
"GET", artifact.archive_download_url, headers=pull.headers("json")
930-
)
939+
data = pull.download_json_artifact(artifact)
931940
except GithubException as exc:
932941
print(
933942
f"WARNING: Couldn't automatically download artifacts for workflow '{workflow_id}', response was: {exc}"

0 commit comments

Comments
 (0)