chore(deps): bump github.com/gin-gonic/gin from 1.10.1 to 1.12.0 #112
Workflow file for this run
This file contains hidden or 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: ci-rerun-flaky | |
| on: | |
| pull_request_target: | |
| types: | |
| - labeled | |
| permissions: | |
| actions: write | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| rerun-failed-jobs: | |
| name: rerun-failed-jobs | |
| if: github.event.label.name == 'ci:rerun-flaky' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Rerun failed CI jobs and remove rerun label | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const label = 'ci:rerun-flaky'; | |
| const { owner, repo } = context.repo; | |
| const pr = context.payload.pull_request; | |
| const headSha = pr.head.sha; | |
| const workflows = [ | |
| 'pr-test-build.yml', | |
| 'pr-path-guard.yml', | |
| ]; | |
| let rerunCount = 0; | |
| for (const workflow_id of workflows) { | |
| const runsResp = await github.rest.actions.listWorkflowRuns({ | |
| owner, | |
| repo, | |
| workflow_id, | |
| event: 'pull_request', | |
| head_sha: headSha, | |
| per_page: 1, | |
| }); | |
| const run = runsResp.data.workflow_runs[0]; | |
| if (!run) { | |
| core.info(`No run found for ${workflow_id} at ${headSha}`); | |
| continue; | |
| } | |
| if (run.status !== 'completed') { | |
| core.info(`Run ${run.id} for ${workflow_id} is still ${run.status}; skipping rerun.`); | |
| continue; | |
| } | |
| if (run.conclusion === 'success') { | |
| core.info(`Run ${run.id} for ${workflow_id} is already successful; skipping.`); | |
| continue; | |
| } | |
| try { | |
| await github.request('POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs', { | |
| owner, | |
| repo, | |
| run_id: run.id, | |
| }); | |
| rerunCount += 1; | |
| core.notice(`Triggered rerun of failed jobs for run ${run.id} (${workflow_id}).`); | |
| } catch (error) { | |
| core.warning(`Failed to trigger rerun for run ${run.id} (${workflow_id}): ${error.message}`); | |
| } | |
| } | |
| try { | |
| await github.rest.issues.removeLabel({ | |
| owner, | |
| repo, | |
| issue_number: pr.number, | |
| name: label, | |
| }); | |
| core.notice(`Removed label '${label}' from PR #${pr.number}.`); | |
| } catch (error) { | |
| if (error.status === 404) { | |
| core.info(`Label '${label}' was already removed from PR #${pr.number}.`); | |
| } else { | |
| throw error; | |
| } | |
| } | |
| if (rerunCount === 0) { | |
| core.notice('No failed CI runs were eligible for rerun.'); | |
| } |