File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff 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 and a 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 (
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ function at-exit {
3838 $retcode " ${BUILD_DIR} " /test-results.* .xml " ${MONOREPO_ROOT} " /ninja* .log \
3939 >> $GITHUB_STEP_SUMMARY
4040 python " ${MONOREPO_ROOT} " /.ci/premerge_advisor_explain.py \
41- $( git rev-parse HEAD~1) $retcode ${{ secrets. GITHUB_TOKEN } } \
41+ $( git rev-parse HEAD~1) $retcode " ${ GITHUB_TOKEN} " \
4242 $GITHUB_PR_NUMBER " ${BUILD_DIR} " /test-results.* .xml \
4343 " ${MONOREPO_ROOT} " /ninja* .log
4444 fi
Original file line number Diff line number Diff line change 6464 - name : Build and Test
6565 timeout-minutes : 120
6666 continue-on-error : ${{ runner.arch == 'ARM64' }}
67+ env :
68+ GITHUB_TOKEN : ${{ github.token }}
6769 run : |
6870 git config --global --add safe.directory '*'
6971
@@ -117,6 +119,7 @@ jobs:
117119 retention-days : 5
118120 include-hidden-files : ' true'
119121 - name : Upload Comment
122+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
120123 if : always()
121124 continue-on-error : true
122125 with :
@@ -160,6 +163,8 @@ jobs:
160163 timeout-minutes : 180
161164 if : ${{ steps.vars.outputs.windows-projects != '' }}
162165 shell : cmd
166+ env :
167+ GITHUB_TOKEN : ${{ github.token }}
163168 run : |
164169 call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
165170 # See the comments above in the Linux job for why we define each of
You can’t perform that action at this time.
0 commit comments