added fields to the metadata to make manual

filtering easier
This commit is contained in:
Karma Riuk
2025-05-20 09:51:50 +02:00
parent 3ffbb229b8
commit 15ffe67b0e
2 changed files with 23 additions and 4 deletions

View File

@ -45,7 +45,9 @@ class Metadata:
pr_title: str pr_title: str
pr_body: str pr_body: str
merge_commit_sha: str # to checkout for the tests merge_commit_sha: str # to checkout for the tests
successful: bool = True is_covered: Optional[bool] = None
is_code_related: Optional[bool] = None
successful: Optional[bool] = None
build_system: str = "" build_system: str = ""
reason_for_failure: str = "" reason_for_failure: str = ""
last_cmd_error_msg: str = "" last_cmd_error_msg: str = ""

View File

@ -332,10 +332,12 @@ def process_pull(
if all(not comment.file.endswith(".java") for comment in entry.comments): if all(not comment.file.endswith(".java") for comment in entry.comments):
# if the commented files are all not code related, why bother compiling and testing the code? # if the commented files are all not code related, why bother compiling and testing the code?
pbar.update(5) pbar.update(5)
if entry.metadata.successful: entry.metadata.is_code_related = False
metadata.successful = True
entry.metadata.reason_for_failure = "Valid PR! But isn't code related though." entry.metadata.reason_for_failure = "Valid PR! But isn't code related though."
return return
entry.metadata.is_code_related = True
with build_handler: with build_handler:
try: try:
for message, action in steps: for message, action in steps:
@ -351,12 +353,27 @@ def process_pull(
entry.metadata.last_cmd_error_msg = str(e) entry.metadata.last_cmd_error_msg = str(e)
entry.metadata.reason_for_failure = e.reason_for_failure entry.metadata.reason_for_failure = e.reason_for_failure
entry.metadata.successful = False entry.metadata.successful = False
else:
entry.metadata.successful = True
finally: finally:
build_handler.clean_repo() build_handler.clean_repo()
reset_repo_to_latest_commit(repo_path) reset_repo_to_latest_commit(repo_path)
commented_files = [comment.file for comment in entry.comments]
is_covered = True
for file_name in commented_files:
coverage = entry.files[file_name].coverage
if len(coverage) == 0 or all(value == 0 for value in coverage.values()):
is_covered = False
break
entry.metadata.is_covered = is_covered
if entry.metadata.successful: if entry.metadata.successful:
entry.metadata.reason_for_failure = "Valid PR!" # was set to 'still processing', since it's done being processed and was successful, there are no reasons for failure if entry.metadata.is_covered:
entry.metadata.reason_for_failure = "Valid PR!"
else:
entry.metadata.reason_for_failure = "Valid PR! But not covered :("
def process_repo( def process_repo(