GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Auto-port 4.1: Add workflow that will cancel running workflows for me… · lltopk/netty@9568693

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • cancel-on-merge.yml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/cancel-on-merge.yml‎

Copy file name to clipboard
+37Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Fork of https://github.com/AgentWorkforce/relay/blob/v12.2.2/.github/workflows/cancel-on-merge.yml
2+
name: Cancel PR Jobs on Merge
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
cancel:
9+
if: github.event.pull_request.merged == true
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Cancel running workflows for this PR
13+
uses: actions/github-script@v7
14+
with:
15+
script: |
16+
const { owner, repo } = context.repo;
17+
const headSha = context.payload.pull_request.head.sha;
18+
19+
// Get all running workflow runs for this commit
20+
const runs = await github.rest.actions.listWorkflowRunsForRepo({
21+
owner,
22+
repo,
23+
status: 'in_progress',
24+
head_sha: headSha,
25+
});
26+
27+
// Cancel each running workflow
28+
for (const run of runs.data.workflow_runs) {
29+
console.log(`Cancelling workflow run ${run.id} (${run.name})`);
30+
await github.rest.actions.cancelWorkflowRun({
31+
owner,
32+
repo,
33+
run_id: run.id,
34+
});
35+
}
36+
37+
console.log(`Cancelled ${runs.data.workflow_runs.length} workflow runs`);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.