Skip to content

Commit

Permalink
Merge pull request #55750 from ClickHouse/use-diff-object-in-pr_info
Browse files Browse the repository at this point in the history
Use diff object again, since JSON API limits the files
  • Loading branch information
robot-ch-test-poll3 committed Oct 17, 2023
2 parents 1d46ed7 + b382705 commit e85bf21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 9 additions & 4 deletions tests/ci/pr_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import os
from typing import Dict, List, Set, Union, Literal

from unidiff import PatchSet # type: ignore

from build_download_helper import get_gh_api
from env_helper import (
GITHUB_REPOSITORY,
Expand Down Expand Up @@ -263,11 +265,14 @@ def fetch_changed_files(self):
raise TypeError("The event does not have diff URLs")

for diff_url in self.diff_urls:
response = get_gh_api(diff_url, sleep=RETRY_SLEEP)
response = get_gh_api(
diff_url,
sleep=RETRY_SLEEP,
headers={"Accept": "application/vnd.github.v3.diff"},
)
response.raise_for_status()
diff = response.json()
if "files" in diff:
self.changed_files = {f["filename"] for f in diff["files"]}
diff_object = PatchSet(response.text)
self.changed_files.update({f.path for f in diff_object})
print(f"Fetched info about {len(self.changed_files)} changed files")

def get_dict(self):
Expand Down
1 change: 0 additions & 1 deletion tests/ci/worker/prepare-ci-ami.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ systemctl restart docker
sudo -u ubuntu docker buildx version
sudo -u ubuntu docker buildx create --use --name default-builder

# FIXME: remove unidiff as soon as no old PRs could use it, here and in Dockerfile
pip install boto3 pygithub requests urllib3 unidiff dohq-artifactory

mkdir -p $RUNNER_HOME && cd $RUNNER_HOME
Expand Down

0 comments on commit e85bf21

Please sign in to comment.