Skip to content

Rerun Workflow with Known Errors #6

Rerun Workflow with Known Errors

Rerun Workflow with Known Errors #6

name: Rerun Workflow with Known Errors
on:
workflow_run:
workflows:
- Linux (Ubuntu 20.04, Python 3.11)
- 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)
- Windows Conditional Compilation (VS 2022, Python 3.11)
types:
- completed
pull_request:
paths:
- '.github/workflows/workflow_rerunner.yml'
- '.github/scripts/workflow_rerun/**'
jobs:
rerun:
name: Rerun Workflow
if: ${{ github.event.workflow_run.conclusion == 'failure' }} # Run only for the completed workflows
runs-on: aks-linux-2-cores-8gb
permissions:
actions: write
contents: read
statuses: read
checks: read
steps:
- name: Checkout
uses: actions/checkout@v4
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}
rerunner_tests:
name: Rerunner Tests
if: ${{ github.event_name == 'pull_request' }}
runs-on: aks-linux-2-cores-8gb
steps:
- name: Checkout
uses: actions/checkout@v4
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
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