Skip to content

Commit 7e44989

Browse files
docs
Created using spr 1.3.7
1 parent 7e90d65 commit 7e44989

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.ci/premerge_advisor_explain.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,31 @@ def main(
4848
pr_number: int,
4949
return_code: int,
5050
):
51+
"""The main entrypoint for the script.
52+
53+
This function parses failures from files, requests information from the
54+
premerge advisor, and may write a Github comment depending upon the output.
55+
There are four different scenarios:
56+
1. There has never been a previous failure and the job passes - We do not
57+
create a comment. We write out an empty file to the comment path so the
58+
issue-write workflow knows not to create anything.
59+
2. There has never been a previous failure and the job fails - We create a
60+
new comment containing the failure information and any possible premerge
61+
advisor findings.
62+
3. There has been a previous failure and the job passes - We update the
63+
existing comment by passing its ID anda passed message to the
64+
issue-write workflow.
65+
4. There has been a previous failure and the job fails - We update the
66+
existing comment in the same manner as above, but generate the comment
67+
as if we have a failure.
68+
69+
Args:
70+
commit_sha: The base commit SHA for this PR run.
71+
build_log_files: The list of JUnit XML files and ninja logs.
72+
github_token: The token to use to access the Github API.
73+
pr_number: The number of the PR associated with this run.
74+
return_code: The numerical return code of ninja/CMake.
75+
"""
5176
if return_code == 0:
5277
with open("comment", "w") as comment_file_handle:
5378
comment = get_comment(

0 commit comments

Comments
 (0)