Do not run the same workflow concurrently on non-main branches (#3518)

<img width="1376" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/681cca85-e1b9-4a99-8363-60c931ba1393">

For any push (or force-push) into a branch, a separate CI workflow is
run.
This is rather worker-consuming, esp. given the fact that GitHub will
wait for the last job to update PR's status.
So cancel every old job for the same branch if it's not `main`.
CI run on `main` might catch a regression brought in by specific PR
merged, so run CI on every commit due to that.


Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2023-12-06 22:35:02 +02:00 committed by GitHub
commit ebddb612c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,11 @@ on:
branches: branches:
- "**" - "**"
concurrency:
# Allow only one workflow per any non-`main` branch.
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
cancel-in-progress: true
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0 CARGO_INCREMENTAL: 0