Skip to content

Rerun Workflow with Known Errors #137800

Rerun Workflow with Known Errors

Rerun Workflow with Known Errors #137800

name: Rerun Workflow with Known Errors
on:
workflow_run:
workflows:
- Linux (Ubuntu 20.04, Python 3.9)
- Linux (Ubuntu 22.04, Python 3.11)
- Linux (Ubuntu 24.04, Python 3.12)
- Debian 10 ARM
- Android ARM64 with vcpkg
- Android x64
- Linux ARM64 (Ubuntu 20.04, Python 3.11)
- Linux Static CC (Ubuntu 22.04, Python 3.11, Clang)
- Linux RISC-V with Conan (Ubuntu 22.04, Python 3.10)
- Windows (VS 2019, Python 3.11, Release)
- Windows (VS 2019, Python 3.11, Debug)
- Windows Conditional Compilation (VS 2022, Python 3.11)
types:
- completed
pull_request:
paths:
- '.github/workflows/workflow_rerunner.yml'
- '.github/scripts/workflow_rerun/**'
permissions: read-all
jobs:
rerun:
name: Rerun Workflow
# Run only for the failed workflows in openvinotoolkit org
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.repository_owner == 'openvinotoolkit' }}
runs-on: aks-linux-2-cores-8gb
permissions:
actions: write
contents: read
statuses: read
checks: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: '.github/scripts/workflow_rerun'
- name: Install deps
run: pip3 install PyGithub==2.2.0 requests==2.31.0
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Rerun
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export PYTHONPATH=${{ github.workspace }}/.github/scripts/workflow_rerun:${{ github.workspace }}/.github/scripts:$PYTHONPATH
python3 ${{ github.workspace }}/.github/scripts/workflow_rerun/rerunner.py \
--run-id ${{ github.event.workflow_run.id }} \
--repository-name ${GITHUB_REPOSITORY}
- name: Rerun Retriggered (Ticket ${{ env.FOUND_ERROR_TICKET }})
if: ${{ env.PIPELINE_RETRIGGERED == 'true' }}
run: echo "Rerun retriggered for ${{ github.event.workflow_run.html_url }} with ticket ${{ env.FOUND_ERROR_TICKET }}"
- name: ${{ github.event.workflow_run.html_url }}
if: ${{ env.PIPELINE_RETRIGGERED == 'true' }}
run: echo "Step for statistics gathering"
rerunner_tests:
name: Rerunner Tests
if: ${{ github.event_name == 'pull_request' && github.repository_owner == 'openvinotoolkit' }}
runs-on: aks-linux-2-cores-8gb
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: '.github/scripts/workflow_rerun'
lfs: true
- name: Install deps
run: pip3 install PyGithub==2.2.0 requests==2.31.0
- name: Test Rerunner (Tests)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ github.workspace }}/.github/scripts/workflow_rerun
run: |
export PYTHONPATH=${{ github.workspace }}/.github/scripts/workflow_rerun:${{ github.workspace }}/.github/scripts:$PYTHONPATH
python3 -m unittest tests/*_test.py
- name: Test Rerunner (CLI)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ github.workspace }}/.github/scripts/workflow_rerun
run: |
export PYTHONPATH=${{ github.workspace }}/.github/scripts/workflow_rerun:${{ github.workspace }}/.github/scripts:$PYTHONPATH
# Need to get a run id with successful status for log analyzing
# cannot lock a run id as logs get deleted after some time
run_id=$(python3 -c "from github import Github, Auth; import os; github=Github(auth=Auth.Token(token=os.environ.get('GITHUB_TOKEN'))); repo = github.get_repo('${GITHUB_REPOSITORY}'); run_id = repo.get_workflow_runs(status='success')[0].id; print(run_id)")
python3 rerunner.py --repository-name ${GITHUB_REPOSITORY} --run-id $run_id --dry-run