CI/GHA: cancel outdated CI runs on new PR changes

Avoid letting outdated CI runs continue if a PR receives
new changes. Outside a PR we let them continue running
by tying the concurrency to the commit hash instead.

Also only let one CodeQL or Hacktoberfest job run at a time.

Other CI platforms we use have this build in, but GitHub
unfortunately neither by default nor with a simple option.

This saves CI resources and therefore a little energy.

Approved-by: Daniel Stenberg
Approved-by: Max Dymond
Closes #9533
This commit is contained in:
Marc Hoersken 2022-09-17 23:45:32 +02:00
parent fda897f5a1
commit 4e6893307b
No known key found for this signature in database
GPG key ID: 61E03CBED7BC859E
14 changed files with 62 additions and 23 deletions

View file

@ -5,11 +5,15 @@
name: Hacktoberfest
on:
# run for all pushes to master branch
# this must not ever run on any other branch than master
push:
branches:
- master
concurrency:
# this should not run in parallel, so just run one at a time
group: ${{ github.workflow }}
permissions:
# requires issues AND pull-requests write permissions to edit labels on PRs!
issues: write