name: Rerun Flaky Tests on: workflow_run: workflows: ["CI Pipeline", "CI Security"] types: - completed jobs: rerun_flaky_tests: name: Rerun Flaky Tests runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.run_attempt < 5 }} steps: - name: Checkout uses: actions/checkout@v4 - name: Generate App Token id: app-token-generation uses: actions/create-github-app-token@v1 with: app-id: ${{ secrets.APP_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} - name: Rerun flaky tests uses: actions/github-script@v7 with: github-token: ${{ steps.app-token-generation.outputs.token }} script: | const { rerunFlakyTests } = await import('${{ github.workspace }}/.github/workflows/scripts/rerunFlakyTests.js') await rerunFlakyTests({ github, context })