@@ -147,7 +147,7 @@ jobs:
147147 check_new_failures :
148148 name : " Find commits for new failing tests"
149149 needs : setup_check_new_failures
150- if : ${{ needs.setup_check_new_failures.outputs.process == 'true' }}
150+ if : needs.setup_check_new_failures.outputs.process == 'true'
151151 strategy :
152152 matrix :
153153 run_idx : ${{ fromJson(needs.setup_check_new_failures.outputs.matrix) }}
@@ -219,30 +219,9 @@ jobs:
219219
220220 core.setOutput('merge_commit_base_sha', merge_commit.parents[0].sha);
221221
222- - name : Get workflow ID
223- if : ${{ inputs.pr_number == '' }}
224- id : get-workflow-id
225- env :
226- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
227- SOURCE_WORKFLOW_RUN_ID : ${{ inputs.source_workflow_run_id }}
228- WORKFLOW_RUN_ID : ${{ github.run_id }}
229- RUN_ID : ${{ inputs.source_workflow_run_id || github.run_id }}
230- REPO : ${{ github.repository }}
231- run : |
232- workflow_id=$(python3 << 'EOF'
233- import requests, os
234-
235- url = f"https://api.github.com/repos/{os.environ['REPO']}/actions/runs/{os.environ['RUN_ID']}"
236- headers = {"Authorization": f"Bearer {os.environ['GH_TOKEN']}"}
237- print(requests.get(url, headers=headers).json()["workflow_id"])
238- EOF
239- )
240-
241- echo "workflow_id=$workflow_id" >> $GITHUB_OUTPUT
242- echo "SOURCE_WORKFLOW_RUN_ID: $SOURCE_WORKFLOW_RUN_ID"
243- echo "WORKFLOW_RUN_ID: $WORKFLOW_RUN_ID"
244- echo "RUN_ID: $RUN_ID"
245- echo "workflow_id: $workflow_id"
222+ - name : Set `END_SHA` from artifact override
223+ if : ${{ needs.setup_check_new_failures.outputs.end_sha != '' }}
224+ run : echo "END_SHA=${{ needs.setup_check_new_failures.outputs.end_sha }}" >> $GITHUB_ENV
246225
247226 # Usually, `END_SHA` should be the commit of the last previous workflow run of the **SAME** (scheduled) workflow.
248227 # (This is why we don't need to specify `workflow_id` which would be fetched automatically in the python script.)
@@ -253,17 +232,13 @@ jobs:
253232 ACCESS_TOKEN : ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
254233 WORKFLOW_ID : ${{ steps.get-workflow-id.outputs.workflow_id }}
255234 run : |
256- echo "END_SHA=$(TOKEN="$ACCESS_TOKEN" python3 -c 'import os; from get_previous_daily_ci import get_last_daily_ci_run_commit; commit=get_last_daily_ci_run_commit(token=os.environ["TOKEN"], workflow_run_id=os.environ["PREV_WORKFLOW_RUN_ID"], workflow_id=os.environ["WORKFLOW_ID"]); print(commit)')" >> $GITHUB_ENV
257-
258- - name : Set `END_SHA` from artifact override
259- if : ${{ needs.setup_check_new_failures.outputs.end_sha != '' }}
260- run : echo "END_SHA=${{ needs.setup_check_new_failures.outputs.end_sha }}" >> $GITHUB_ENV
235+ echo "END_SHA=$(TOKEN="$ACCESS_TOKEN" python3 -c 'import os; from get_previous_daily_ci import get_last_daily_ci_run_commit; commit=get_last_daily_ci_run_commit(token=os.environ["TOKEN"], workflow_run_id=os.environ["PREV_WORKFLOW_RUN_ID"]); print(commit)')" >> $GITHUB_ENV
261236
262237 # However, for workflow runs triggered by `issue_comment` (for pull requests), we want to check against the
263238 # parent commit (on `main`) of the `merge_commit` (dynamically created by GitHub). In this case, the goal is to
264239 # see if a reported failing test is actually ONLY failing on the `merge_commit`.
265240 - name : Set `END_SHA`
266- if : ${{ inputs.pr_number != '' }}
241+ if : ${{ inputs.pr_number != '' && needs.setup_check_new_failures.outputs.end_sha == '' }}
267242 env :
268243 merge_commit_base_sha : ${{ steps.pr_info.outputs.merge_commit_base_sha }}
269244 run : |
@@ -296,8 +271,7 @@ jobs:
296271 n_runners : ${{ needs.setup_check_new_failures.outputs.n_runners }}
297272 run_idx : ${{ matrix.run_idx }}
298273 pr_number : ${{ inputs.pr_number }}
299- run : |
300- python3 utils/check_bad_commit.py --start_commit "$START_SHA" --end_commit "$END_SHA" --file "ci_results_${job}/new_failures.json" --output_file "new_failures_with_bad_commit_${job}_${run_idx}.json"
274+ run : python3 utils/check_bad_commit.py --start_commit "$START_SHA" --end_commit "$END_SHA" --file "ci_results_${job}/new_failures.json" --output_file "new_failures_with_bad_commit_${job}_${run_idx}.json"
301275
302276 - name : Show results
303277 working-directory : /transformers
0 commit comments