I have 2 conditions under which I want to run my workflows in GH actions on a go
project
- run unit tests on every PR (I have already taken care of this with the following
workflow.yaml
name: unit-tests
on: [ pull_request ]
jobs:
unit-tests:
runs-on: Linux
steps:
- name: checkout project
uses: actions/checkout@v2
- name: dynamically retrieve go version
uses: arnested/go-version-action@v1
id: go-version
- name: setup go ${{ steps.go-version.outputs.minimal }}
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go-version.outputs.minimal }}
- name: run unit tests
run: go test -race -cover -v ./... -run Unit
My second requirement is the following:
- run unit tests AND proceed to creating a tag + release if the tests succeed and the target branch is
master
My question is the following: Since the on
clause is unique per workflow, is there a way I can leverage the above workflow (without the need to write a more or less clone) that can be integrated in the second use case?