Rerun failed workflows #328
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rerun failed workflows | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 22 * * *' # GMT time, 22:00 GMT == 07:00 China | |
push: | |
branches: | |
- main | |
jobs: | |
# rerun_nightly_test: | |
# runs-on: ubuntu-latest | |
# steps: | |
# # - uses: actions/checkout@v3 | |
# # - uses: ./.github/actions/rerun_failed_workflow | |
# # with: | |
# # workflow_name: 'nightly_test.yml' | |
# - uses: octokit/[email protected] | |
# id: get_latest_release | |
# with: | |
# route: GET /repos/intel-analytics/BigDL/actions/workflows/nightly_test.yml/runs | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | |
# - run: | | |
# run_id=`echo '${{ steps.get_latest_release.outputs.data }}' | jq --arg today $(date -u +%Y-%m-%d) '.workflow_runs[] | if .event == "schedule" and .status == "completed" and .created_at[:10] == $today then .id else null end | values'` | |
# echo $run_id | |
# echo "RUN_ID=$run_id" >> $GITHUB_ENV | |
# - uses: octokit/[email protected] | |
# if: ${{ env.RUN_ID }} | |
# with: | |
# route: POST /repos/intel-analytics/BigDL/actions/runs/{run_id}/rerun-failed-jobs | |
# run_id: ${{ env.RUN_ID }} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | |
# rerun_nano_nightly_test: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: octokit/[email protected] | |
# id: get_latest_release | |
# with: | |
# route: GET /repos/intel-analytics/BigDL/actions/workflows/nano-nightly-test.yml/runs | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | |
# - run: | | |
# run_id=`echo '${{ steps.get_latest_release.outputs.data }}' | jq --arg today $(date -u +%Y-%m-%d) '.workflow_runs[] | if .event == "schedule" and .status == "completed" and .created_at[:10] == $today then .id else null end | values'` | |
# echo $run_id | |
# echo "RUN_ID=$run_id" >> $GITHUB_ENV | |
# - uses: octokit/[email protected] | |
# if: ${{ env.RUN_ID }} | |
# with: | |
# route: POST /repos/intel-analytics/BigDL/actions/runs/{run_id}/rerun-failed-jobs | |
# run_id: ${{ env.RUN_ID }} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | |
rerun_nightly_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get run_id | |
run: | | |
curl -o workspaces.json \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.ACTIONS_PAT }}" \ | |
https://api.github.com/repos/intel-analytics/BigDL/actions/workflows/nightly_test.yml/runs | |
run_id=`cat workspaces.json | jq --arg today $(date -u +%Y-%m-%d) '.workflow_runs[] | if .event == "schedule" and .status == "completed" and .created_at[:10] == $today then .id else null end | values'` | |
echo $run_id | |
echo "RUN_ID=$run_id" >> $GITHUB_ENV | |
cat workspaces.json | |
rm -f workspaces.json | |
- name: rerun failed workflow | |
uses: octokit/[email protected] | |
if: ${{ env.RUN_ID }} | |
with: | |
route: POST /repos/intel-analytics/BigDL/actions/runs/{run_id}/rerun-failed-jobs | |
run_id: ${{ env.RUN_ID }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | |
rerun_mac_nightly_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get run_id | |
run: | | |
curl -o workspaces.json \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.ACTIONS_PAT }}" \ | |
https://api.github.com/repos/intel-analytics/BigDL/actions/workflows/mac_nightly_test.yml/runs | |
run_id=`cat workspaces.json | jq --arg today $(date -u +%Y-%m-%d) '.workflow_runs[] | if .event == "schedule" and .status == "completed" and .created_at[:10] == $today then .id else null end | values'` | |
echo $run_id | |
echo "RUN_ID=$run_id" >> $GITHUB_ENV | |
rm -f workspaces.json | |
- name: rerun failed workflow | |
uses: octokit/[email protected] | |
if: ${{ env.RUN_ID }} | |
with: | |
route: POST /repos/intel-analytics/BigDL/actions/runs/{run_id}/rerun-failed-jobs | |
run_id: ${{ env.RUN_ID }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | |
rerun_nano_nightly_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get run_id | |
run: | | |
curl -o workspaces.json \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.ACTIONS_PAT }}" \ | |
https://api.github.com/repos/intel-analytics/BigDL/actions/workflows/nano-nightly-test.yml/runs | |
run_id=`cat workspaces.json | jq --arg today $(date -u +%Y-%m-%d) '.workflow_runs[] | if .event == "schedule" and .status == "completed" and .created_at[:10] == $today then .id else null end | values'` | |
echo $run_id | |
echo "RUN_ID=$run_id" >> $GITHUB_ENV | |
rm -f workspaces.json | |
- name: rerun failed workflow | |
uses: octokit/[email protected] | |
if: ${{ env.RUN_ID }} | |
with: | |
route: POST /repos/intel-analytics/BigDL/actions/runs/{run_id}/rerun-failed-jobs | |
run_id: ${{ env.RUN_ID }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | |
rerun_chronos_nightly_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get run_id | |
run: | | |
curl -o workspaces.json \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.ACTIONS_PAT }}" \ | |
https://api.github.com/repos/intel-analytics/BigDL/actions/workflows/chronos-nb-python-spark31.yml/runs | |
run_id=`cat workspaces.json | jq --arg today $(date -u +%Y-%m-%d) '.workflow_runs[] | if .event == "schedule" and .status == "completed" and .created_at[:10] == $today then .id else null end | values'` | |
echo $run_id | |
echo "RUN_ID=$run_id" >> $GITHUB_ENV | |
rm -f workspaces.json | |
- name: rerun failed workflow | |
uses: octokit/[email protected] | |
if: ${{ env.RUN_ID }} | |
with: | |
route: POST /repos/intel-analytics/BigDL/actions/runs/{run_id}/rerun-failed-jobs | |
run_id: ${{ env.RUN_ID }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} |