Skip to content

Commit 9471763

Browse files
committed
fix
1 parent 58da915 commit 9471763

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/check_failed_tests.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,33 @@ jobs:
200200
201201
core.setOutput('merge_commit_base_sha', merge_commit.parents[0].sha);
202202
203+
- name: Get workflow ID
204+
if: ${{ inputs.pr_number == '' }}
205+
id: get-workflow-id
206+
env:
207+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208+
SOURCE_WORKFLOW_RUN_ID: ${{ inputs.source_workflow_run_id }}
209+
WORKFLOW_RUN_ID: ${{ github.run_id }}
210+
RUN_ID: ${{ inputs.source_workflow_run_id || github.run_id }}
211+
REPO: ${{ github.repository }}
212+
run: |
213+
workflow_id=$(gh api repos/$REPO/actions/runs/$RUN_ID --jq '.workflow_id')
214+
echo "workflow_id=$workflow_id" >> $GITHUB_OUTPUT
215+
echo "SOURCE_WORKFLOW_RUN_ID: $SOURCE_WORKFLOW_RUN_ID"
216+
echo "WORKFLOW_RUN_ID: $WORKFLOW_RUN_ID"
217+
echo "RUN_ID: $RUN_ID"
218+
echo "workflow_id: $workflow_id"
219+
203220
# Usually, `END_SHA` should be the commit of the last previous workflow run of the **SAME** (scheduled) workflow.
204221
# (This is why we don't need to specify `workflow_id` which would be fetched automatically in the python script.)
205222
- name: Get `END_SHA` from previous CI runs of the same workflow
206223
working-directory: /transformers/utils
207224
if: ${{ inputs.pr_number == '' }}
208225
env:
209226
ACCESS_TOKEN: ${{ secrets.ACCESS_REPO_INFO_TOKEN }}
227+
WORKFLOW_ID: ${{ steps.get-workflow-id.outputs.workflow_id }}
210228
run: |
211-
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
229+
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_RUN_ID"]); print(commit)')" >> $GITHUB_ENV
212230
213231
# However, for workflow runs triggered by `issue_comment` (for pull requests), we want to check against the
214232
# parent commit (on `main`) of the `merge_commit` (dynamically created by GitHub). In this case, the goal is to

0 commit comments

Comments
 (0)