Skip to content

Commit 06c030d

Browse files
fix
Created using spr 1.3.7
1 parent 90b2866 commit 06c030d

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

.ci/premerge_advisor_explain.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,11 @@ def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> int | N
3131
def get_comment(
3232
github_token: str,
3333
pr_number: int,
34-
junit_objects,
35-
ninja_logs,
36-
advisor_response,
37-
return_code,
34+
body: str,
3835
) -> dict[str, str]:
3936
repo = github.Github(github_token).get_repo("llvm/llvm-project")
4037
pr = repo.get_issue(pr_number).as_pull_request()
41-
comment = {
42-
"body": generate_test_report_lib.generate_report(
43-
generate_test_report_lib.compute_platform_title(),
44-
return_code,
45-
junit_objects,
46-
ninja_logs,
47-
failure_explanations_list=advisor_response,
48-
)
49-
}
38+
comment = {"body": body}
5039
comment_id = get_comment_id(platform.system(), pr)
5140
if comment_id:
5241
comment["id"] = comment_id
@@ -59,6 +48,14 @@ def main(
5948
pr_number: int,
6049
return_code: int,
6150
):
51+
if return_code == 0:
52+
with open("comment", "w") as comment_file_handle:
53+
comment = get_comment(
54+
":white_check_mark: With the latest revision this PR passed "
55+
"the premerge checks."
56+
)
57+
if comment["id"]:
58+
json.dump([comment], comment_file_handle)
6259
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
6360
build_log_files
6461
)
@@ -90,10 +87,13 @@ def main(
9087
get_comment(
9188
github_token,
9289
pr_number,
93-
junit_objects,
94-
ninja_logs,
95-
advisor_response.json(),
96-
return_code,
90+
generate_test_report_lib.generate_report(
91+
generate_test_report_lib.compute_platform_title(),
92+
return_code,
93+
junit_objects,
94+
ninja_logs,
95+
failure_explanations_list=advisor_response.json(),
96+
),
9797
)
9898
]
9999
with open("comment", "w") as comment_file_handle:

.ci/utils.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ function at-exit {
3333
# If building fails there will be no results files.
3434
shopt -s nullglob
3535

36-
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
36+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
3737
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
3838
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
3939
>> $GITHUB_STEP_SUMMARY
40+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
41+
$(git rev-parse HEAD~1) $retcode ${{ secrets.GITHUB_TOKEN }} \
42+
$GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \
43+
"${MONOREPO_ROOT}"/ninja*.log
4044
fi
4145

4246
if [[ "$retcode" != "0" ]]; then
4347
if [[ "$GITHUB_ACTIONS" != "" ]]; then
44-
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
45-
$(git rev-parse HEAD~1) $retcode ${{ secrets.GITHUB_TOKEN }} \
46-
$GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \
47-
"${MONOREPO_ROOT}"/ninja*.log
4848
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
4949
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
5050
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log

0 commit comments

Comments
 (0)