@@ -64,13 +64,15 @@ jobs:
6464 - name : Check file
6565 id : check_file
6666 working-directory : /transformers
67+ env :
68+ job : ${{ inputs.job }}
6769 run : |
68- if [ -f ci_results_${{ inputs. job }} /new_failures.json ]; then
69- echo "`ci_results_${{ inputs. job }} /new_failures.json` exists, continue ..."
70+ if [ -f " ci_results_${job} /new_failures.json" ]; then
71+ echo "\ `ci_results_${job} /new_failures.json\ ` exists, continue ..."
7072 echo "process=true" >> $GITHUB_ENV
7173 echo "process=true" >> $GITHUB_OUTPUT
7274 else
73- echo "`ci_results_${{ inputs. job }} /new_failures.json` doesn't exist, abort."
75+ echo "\ `ci_results_${job} /new_failures.json\ ` doesn't exist, abort."
7476 echo "process=false" >> $GITHUB_ENV
7577 echo "process=false" >> $GITHUB_OUTPUT
7678 fi
@@ -94,15 +96,18 @@ jobs:
9496 - name : Update clone
9597 working-directory : /transformers
9698 if : ${{ env.process == 'true' }}
99+ env :
100+ commit_sha : ${{ inputs.commit_sha || github.sha }}
97101 run : |
98- git fetch origin ${{ inputs.commit_sha || github.sha }}
99- git fetch && git checkout ${{ inputs.commit_sha || github.sha }}
102+ git fetch origin "$commit_sha" && git checkout "$commit_sha"
100103
101104 - name : Get `START_SHA`
102105 working-directory : /transformers/utils
103106 if : ${{ env.process == 'true' }}
107+ env :
108+ commit_sha : ${{ inputs.commit_sha || github.sha }}
104109 run : |
105- echo "START_SHA=${{ inputs. commit_sha || github.sha }} " >> $GITHUB_ENV
110+ echo "START_SHA=$commit_sha" >> $GITHUB_ENV
106111
107112 # This is used if the CI is triggered from a pull request `self-comment-ci.yml` (after security check is verified)
108113 - name : Extract the base commit on `main` (of the merge commit created by Github) if it is a PR
@@ -130,16 +135,20 @@ jobs:
130135 - name : Get `END_SHA` from previous CI runs of the same workflow
131136 working-directory : /transformers/utils
132137 if : ${{ env.process == 'true' && inputs.pr_number == '' }}
138+ env :
139+ ACCESS_TOKEN : ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
133140 run : |
134- echo "END_SHA=$(TOKEN=${{ secrets.ACCESS_REPO_INFO_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
141+ 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
135142
136143 # However, for workflow runs triggered by `issue_comment` (for pull requests), we want to check against the
137144 # parent commit (on `main`) of the `merge_commit` (dynamically created by GitHub). In this case, the goal is to
138145 # see if a reported failing test is actually ONLY failing on the `merge_commit`.
139146 - name : Set `END_SHA`
140147 if : ${{ env.process == 'true' && inputs.pr_number != '' }}
148+ env :
149+ merge_commit_base_sha : ${{ steps.pr_info.outputs.merge_commit_base_sha }}
141150 run : |
142- echo "END_SHA=${{ steps.pr_info.outputs. merge_commit_base_sha }} " >> $GITHUB_ENV
151+ echo "END_SHA=$merge_commit_base_sha" >> $GITHUB_ENV
143152
144153 - name : Reinstall transformers in edit mode (remove the one installed during docker image build)
145154 working-directory : /transformers
@@ -169,14 +178,20 @@ jobs:
169178 - name : Check failed tests
170179 working-directory : /transformers
171180 if : ${{ env.process == 'true' }}
172- run : python3 utils/check_bad_commit.py --start_commit ${{ env.START_SHA }} --end_commit ${{ env.END_SHA }} --file ci_results_${{ inputs.job }}/new_failures.json --output_file new_failures_with_bad_commit_${{ inputs.job }}_${{ matrix.run_idx }}.json
181+ env :
182+ job : ${{ inputs.job }}
183+ run_idx : ${{ matrix.run_idx }}
184+ 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"
173185
174186 - name : Show results
175187 working-directory : /transformers
176188 if : ${{ env.process == 'true' }}
189+ env :
190+ job : ${{ inputs.job }}
191+ run_idx : ${{ matrix.run_idx }}
177192 run : |
178- ls -l new_failures_with_bad_commit_${{ inputs. job }} _${{ matrix. run_idx }} .json
179- cat new_failures_with_bad_commit_${{ inputs. job }} _${{ matrix. run_idx }} .json
193+ ls -l " new_failures_with_bad_commit_${job} _${run_idx} .json"
194+ cat " new_failures_with_bad_commit_${job} _${run_idx} .json"
180195
181196 - name : Upload artifacts
182197 uses : actions/upload-artifact@v4
@@ -209,23 +224,28 @@ jobs:
209224
210225 - name : Check files
211226 working-directory : /transformers
227+ env :
228+ job : ${{ inputs.job }}
212229 run : |
213230 ls -la /transformers
214- ls -la /transformers/new_failures_with_bad_commit_${{ inputs. job }}
231+ ls -la " /transformers/new_failures_with_bad_commit_${job}"
215232
216233 # Currently, we only run with a single runner by using `run_idx: [1]`. We might try to run with multiple runners
217234 # to further reduce the false positive caused by flaky tests, which requires further processing to merge reports.
218235 - name : Merge files
219236 shell : bash
220237 working-directory : /transformers
238+ env :
239+ job : ${{ inputs.job }}
221240 run : |
222- cp /transformers/new_failures_with_bad_commit_${{ inputs. job }} /new_failures_with_bad_commit_${{ inputs. job }} _1.json new_failures_with_bad_commit.json
241+ cp " /transformers/new_failures_with_bad_commit_${job} /new_failures_with_bad_commit_${job} _1.json" new_failures_with_bad_commit.json
223242
224243 - name : Update clone
225244 working-directory : /transformers
245+ env :
246+ commit_sha : ${{ inputs.commit_sha || github.sha }}
226247 run : |
227- git fetch origin ${{ inputs.commit_sha || github.sha }}
228- git fetch && git checkout ${{ inputs.commit_sha || github.sha }}
248+ git fetch origin "$commit_sha" && git checkout "$commit_sha"
229249
230250 - name : Process report
231251 shell : bash
@@ -267,9 +287,12 @@ jobs:
267287
268288 - name : Prepare Slack report title
269289 working-directory : /transformers
290+ env :
291+ ci_event : ${{ inputs.ci_event }}
292+ job : ${{ inputs.job }}
270293 run : |
271294 pip install slack_sdk
272- echo "title=$(python3 -c 'import sys; sys.path.append("utils"); from utils.notification_service import job_to_test_map; ci_event = "${{ inputs. ci_event }}" ; job = "${{ inputs. job }}" ; test_name = job_to_test_map[job]; title = f"New failed tests of {ci_event}" + ":" + f" {test_name}"; print(title)')" >> $GITHUB_ENV
295+ echo "title=$(python3 -c 'import sys; import os; sys.path.append("utils"); from utils.notification_service import job_to_test_map; ci_event = os.environ[" ci_event"] ; job = os.environ[" job"] ; test_name = job_to_test_map[job]; title = f"New failed tests of {ci_event}" + ":" + f" {test_name}"; print(title)')" >> $GITHUB_ENV
273296
274297 - name : Send processed report
275298 if : ${{ !endsWith(env.REPORT_TEXT, '{}') }}
0 commit comments