Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use diff object again, since JSON API limits the files #55750

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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