ci-stop-tests-on-merge (#33)

Reviewed-on: graham/towerops-web#33
This commit is contained in:
Graham McIntire 2026-03-15 18:21:59 -05:00 committed by graham
parent 7c8731f86a
commit b8e56ee88c
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,20 @@
name: Cancel Tests on Merge
on:
pull_request:
types: [closed]
branches:
- main
- production
jobs:
cancel-tests:
name: Cancel Running Tests
runs-on: ubuntu-22.04
if: github.event.pull_request.merged == true
steps:
- name: Cancel in-progress workflow runs
uses: https://github.com/styfle/cancel-workflow-action@0.12.1
with:
workflow_id: pr-tests.yaml
all_but_latest: false

View file

@ -2,10 +2,15 @@ name: Pull Request Tests
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- production
concurrency:
group: pr-tests-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
MIX_ENV: test
@ -13,6 +18,8 @@ jobs:
test-exunit:
name: Run ExUnit Tests
runs-on: ubuntu-22.04
# Skip if PR is already merged
if: github.event.pull_request.merged == false
env:
DATABASE_URL: ecto://postgres:postgres@postgres/towerops_test