mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-09 00:04:42 +00:00
e949900bec
Bugfix/combo fixes cancel builds if there's a new one queued get list of current runs on current-branch push test comment out if merge wrap in string actions permissions log more log cancel runs test write permission uncomment pr merge check remove push lol sender branch name better branch lol ref
36 lines
1 KiB
YAML
36 lines
1 KiB
YAML
name: cancel-merged-branches
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- closed
|
|
|
|
jobs:
|
|
cancel_stuff:
|
|
if: github.event.pull_request.merged == true
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
actions: write
|
|
steps:
|
|
- uses: actions/github-script@v7
|
|
id: cancel-runs
|
|
with:
|
|
result-encoding: string
|
|
retries: 3
|
|
script: |
|
|
let branch_workflows = await github.rest.actions.listWorkflowRuns({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
workflow_id: "build-shit.yml",
|
|
status: "queued",
|
|
branch: "${{ github.event.pull_request.head.ref }}"
|
|
});
|
|
let runs = branch_workflows.data.workflow_runs;
|
|
runs.forEach((run) => {
|
|
github.rest.actions.cancelWorkflowRun({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: run.id
|
|
});
|
|
});
|
|
console.log(runs);
|