Improve concurrent ID computation for /run-acceptance-tests (#8148)

* Improve concurrent ID computation so /run-acceptance-tests ids are unique and do not conflict

* Fix syntax

* More toJSON fixes

* Flip if-then-else branches

* Clean up comments
This commit is contained in:
Anton Tayanovskyy 2021-10-06 19:19:51 +00:00 committed by GitHub
parent 9d0c224b35
commit 4dd5022225
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,8 +20,16 @@ env:
# to change.
#
# See also: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
#
# Note on the the `group` computed expression: it is compiling
# `github.head_ref == '' ? github.run_id : github.head_ref` expression
# to the primitives available in GitHub Actions. The idea to use
# `head_ref` on `pull_request` triggers, but use unique
# `github.run_id` on `run-acceptance-tests-command` triggers. This
# effectively disables `concurrency` checks for
# `run-acceptance-tests-command` triggers.
concurrency:
group: run-build-acceptance-tests-${{ github.ref }}-${{ github.head_ref }}
group: run-build-acceptance-tests-${{(fromJSON(format('[{0},{1}]',toJSON(github.head_ref),toJSON(github.run_id))))[github.head_ref=='']}}
cancel-in-progress: true
jobs:
@ -62,10 +70,6 @@ jobs:
name: Lint SDKs
runs-on: ubuntu-latest
steps:
- name: debug ref vs head_ref 2
run: |
echo "github.ref = ${{ github.ref }}"
echo "github.head_ref = ${{ github.head_ref }}"
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v1
with: