Skip to content

refactor: add DatabaseMeta.gc_in_progress #3836

refactor: add DatabaseMeta.gc_in_progress

refactor: add DatabaseMeta.gc_in_progress #3836

Workflow file for this run

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
});
}