Unable to get workflow to trigger another workflow

Hi everyone, I’m hoping I can get some help with an issue I’m having with multiple workflows. Let me explain…

Workflow 1 - version

  • uses semantic-release to generate changelog and push changelog + new tag (does not use github plugin for creating a new release)
    • triggered on workflow_dispatch
    • this workflow is working fine, no issues
    • example tag: v0.5.0

Snippet:

steps:
  - name: checkout
    uses: actions/checkout@v2.3.4
    with:
      persist-credentials: false
### later
  - name: semantic-release
    run: npx semantic-release --ci
    env:
      GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}

SEMANTIC_RELEASE_TOKEN is a PAT with repo permissions. I understand this is required as of actions/checkout v2 in place of GITHUB_TOKEN in order to have one workflow trigger another.

Workflow 2 - release

  • uses goreleaser to create GitHub release for application
  • this workflow is set to run on new tags, as such:
    on:
      push:
        tags:
          - 'v*'
    
     jobs:
      goreleaser:
        name: release
        runs-on: ubuntu-latest
        if: ${{ !github.event.repository.fork }}
        steps:
          - name: checkout
            uses: actions/checkout@v2.3.4
            with:
              token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
    ### do more stuff
    
    Note I’m using the same PAT as the preceding workflow.

The issue

The issue is that the release workflow is not being triggered when new tags are pushed by semantic-release. I’ve searched and there are other posts about this issue, but none of the fixes are working for me.

Fixes I’ve tried

  • persisting credentials in version workflow for actions/checkout
  • persisting credentials in version workflow for actions/checkout while specifying token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
  • various trigger configurations in the release workflow including:
    on:
      push:
        branches:
          - '**'
        tags:
          - 'v*'
    
    This ^ won’t work for me because it triggers on every branch.
    on:
      push:
        branches:
          - '!*'
        tags:
          - 'v*'
    
    This ^ did not help to get the triggers working.
  • adding workflow scope to the PAT

Any help getting this resolved would be greatly appreciated!

I was able to get around this issue by using

on:
  create:
    tags:
      - 'v*'

instead of

on:
  push:
    tags:
      - 'v*'

I then had to add an extra condition to the job:

if: ${{ startsWith(github.ref, 'refs/tags/v') }}

I still don’t think I should have to use on.create instead of on.push, so if anyone has any ideas please let me know.