chore: more recluster log #4143
Workflow file for this run
This file contains 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: Cancel PR Workflow | |
on: | |
pull_request_target: | |
types: | |
- closed | |
permissions: | |
actions: write | |
jobs: | |
cancel: | |
if: github.event.pull_request.merged != true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel workflow runs for the PR | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
const { data: runs } = await github.rest.actions.listWorkflowRuns({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: "dev.yml", | |
}); | |
for (const run of runs.workflow_runs) { | |
if (run.status === "completed") { | |
core.debug(`Skipped completed workflow run: ${run.id}`); | |
continue | |
} | |
if (run.head_sha !== context.payload.pull_request.head.sha) { | |
core.debug(`Skipped different head sha workflow run: ${run.id}`); | |
continue | |
} | |
core.info(`Canceling workflow run: ${run.id} ...`); | |
await github.rest.actions.cancelWorkflowRun({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: run.id | |
}); | |
} |