|
| 1 | +# Workflow runs on main, on a release branch, and that were triggered as part of a merge group have |
| 2 | +# already passed CI before being merged. Therefore if they fail, we should make sure that there |
| 3 | +# wasn't a transient failure by rerunning the failed jobs once before investigating further. |
| 4 | +name: Deflake |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_run: |
| 8 | + types: [completed] |
| 9 | + # Exclude workflows that have significant side effects, like publishing releases. It's OK to |
| 10 | + # retry CodeQL analysis. |
| 11 | + workflows: |
| 12 | + - Check Expected Release Files |
| 13 | + - Code-Scanning config CLI tests |
| 14 | + - CodeQL action |
| 15 | + - Manual Check - go |
| 16 | + - "PR Check - All-platform bundle" |
| 17 | + - "PR Check - Analysis kinds" |
| 18 | + - "PR Check - Analyze: 'ref' and 'sha' from inputs" |
| 19 | + - "PR Check - autobuild-action" |
| 20 | + - "PR Check - Autobuild direct tracing (custom working directory)" |
| 21 | + - "PR Check - Autobuild working directory" |
| 22 | + - "PR Check - Build mode autobuild" |
| 23 | + - "PR Check - Build mode manual" |
| 24 | + - "PR Check - Build mode none" |
| 25 | + - "PR Check - Build mode rollback" |
| 26 | + - "PR Check - Bundle: Caching checks" |
| 27 | + - "PR Check - Bundle: From nightly" |
| 28 | + - "PR Check - Bundle: From toolcache" |
| 29 | + - "PR Check - Bundle: Zstandard checks" |
| 30 | + - "PR Check - C/C++: autoinstalling dependencies (Linux)" |
| 31 | + - "PR Check - C/C++: autoinstalling dependencies is skipped (macOS)" |
| 32 | + - "PR Check - C/C++: disabling autoinstalling dependencies (Linux)" |
| 33 | + - "PR Check - Clean up database cluster directory" |
| 34 | + - "PR Check - CodeQL Bundle All" |
| 35 | + - "PR Check - Config export" |
| 36 | + - "PR Check - Config input" |
| 37 | + - "PR Check - Custom source root" |
| 38 | + - "PR Check - Debug artifact upload" |
| 39 | + - "PR Check - Debug artifacts after failure" |
| 40 | + - "PR Check - Diagnostic export" |
| 41 | + - "PR Check - Export file baseline information" |
| 42 | + - "PR Check - Extractor ram and threads options test" |
| 43 | + - "PR Check - Go: Custom queries" |
| 44 | + - "PR Check - Go: diagnostic when Go is changed after init step" |
| 45 | + - "PR Check - Go: diagnostic when `file` is not installed" |
| 46 | + - "PR Check - Go: tracing with autobuilder step" |
| 47 | + - "PR Check - Go: tracing with custom build steps" |
| 48 | + - "PR Check - Go: tracing with legacy workflow" |
| 49 | + - "PR Check - Go: workaround for indirect tracing" |
| 50 | + - "PR Check - Job run UUID added to SARIF" |
| 51 | + - "PR Check - Language aliases" |
| 52 | + - "PR Check - Local CodeQL bundle" |
| 53 | + - "PR Check - Multi-language repository" |
| 54 | + - "PR Check - Overlay database init fallback" |
| 55 | + - "PR Check - Packaging: Action input" |
| 56 | + - "PR Check - Packaging: Config and input" |
| 57 | + - "PR Check - Packaging: Config and input passed to the CLI" |
| 58 | + - "PR Check - Packaging: Config file" |
| 59 | + - "PR Check - Packaging: Download using registries" |
| 60 | + - "PR Check - Proxy test" |
| 61 | + - "PR Check - Remote config file" |
| 62 | + - "PR Check - Resolve environment" |
| 63 | + - "PR Check - RuboCop multi-language" |
| 64 | + - "PR Check - Ruby analysis" |
| 65 | + - "PR Check - Rust analysis" |
| 66 | + - "PR Check - Split workflow" |
| 67 | + - "PR Check - Start proxy" |
| 68 | + - "PR Check - Submit SARIF after failure" |
| 69 | + - "PR Check - Swift analysis using a custom build command" |
| 70 | + - "PR Check - Swift analysis using autobuild" |
| 71 | + - "PR Check - Test different uses of `upload-sarif`" |
| 72 | + - "PR Check - Test unsetting environment variables" |
| 73 | + - "PR Check - Upload-sarif: ref and sha from inputs" |
| 74 | + - "PR Check - Use a custom `checkout_path`" |
| 75 | + - PR Checks |
| 76 | + - Query filters tests |
| 77 | + - Test that the workaround for python 3.12 on windows works |
| 78 | + |
| 79 | +jobs: |
| 80 | + rerun-on-failure: |
| 81 | + name: Rerun failed workflows |
| 82 | + if: >- |
| 83 | + github.event.workflow_run.conclusion == 'failure' && |
| 84 | + github.event.workflow_run.run_attempt == 1 && |
| 85 | + ( |
| 86 | + github.event.workflow_run.head_branch == 'main' || |
| 87 | + startsWith(github.event.workflow_run.head_branch, 'releases/') || |
| 88 | + github.event.workflow_run.event == 'merge_group' |
| 89 | + ) |
| 90 | + runs-on: ubuntu-slim |
| 91 | + permissions: |
| 92 | + actions: write |
| 93 | + steps: |
| 94 | + - name: Rerun failed jobs in ${{ github.event.workflow_run.name }} |
| 95 | + env: |
| 96 | + GH_TOKEN: ${{ github.token }} |
| 97 | + GH_REPO: ${{ github.repository }} |
| 98 | + RUN_ID: ${{ github.event.workflow_run.id }} |
| 99 | + RUN_NAME: ${{ github.event.workflow_run.name }} |
| 100 | + RUN_URL: ${{ github.event.workflow_run.html_url }} |
| 101 | + run: | |
| 102 | + echo "Rerunning failed jobs for workflow run ${RUN_ID}" |
| 103 | + gh run rerun "${RUN_ID}" --failed |
| 104 | + echo "### Reran failed jobs :recycle:" >> "$GITHUB_STEP_SUMMARY" |
| 105 | + echo "" >> "$GITHUB_STEP_SUMMARY" |
| 106 | + echo "Workflow: [${RUN_NAME}](${RUN_URL})" >> "$GITHUB_STEP_SUMMARY" |
0 commit comments