Skip to content

Commit a67b797

Browse files
[𝘀𝗽𝗿] changes introduced through rebase
Created using spr 1.3.7 [skip ci]
1 parent aa55c55 commit a67b797

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
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 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(

.ci/utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

.github/workflows/premerge.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ jobs:
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
@@ -153,6 +155,8 @@ jobs:
153155
timeout-minutes: 180
154156
if: ${{ steps.vars.outputs.windows-projects != '' }}
155157
shell: cmd
158+
env:
159+
GITHUB_TOKEN: ${{ github.token }}
156160
run: |
157161
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
158162
# See the comments above in the Linux job for why we define each of

0 commit comments

Comments
 (0)