Home > Software design >  GitHub Actions Workflow Not Triggering
GitHub Actions Workflow Not Triggering

Time:11-02

I have a project in which I have two yml files under .github/workflows/ as below:

build.yml
release.yml

I use annotated tags to do releases and here is how the trigger looks like in build.yml:

on:
  push:
    paths-ignore:
      - 'images/**'
      - README.md
    branches:
      - master
    tags:
      - 'v*.*.*'
  pull_request:
    branches:
      - master

And here is how it looks like in release.yml:

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - '[0-9] .[0-9] .[0-9] '

I did the following to push a new annotated tag:

git tag -a v0.0.3-SNAPSHOT -m "My very third tag with release" 
git push origin --tags

I was actually expecting my release.yml to get triggered, but it does not. Is there anything that I'm missing?

CodePudding user response:

The regex will not match your tag 'v0.0.3-SNAPSHOT'. Missing the 'v' and the trailing text section. You could match it with the following:

  - 'v[0-9] .[0-9] .[0-9] -[a-zA-Z]*'

Example can be found here. Not sure why you cant use the '.*' as any character any number of times.

See working example here -> https://github.com/jnus/trigger-semver-tags/blob/main/.github/workflows/workflow.yml

  • Related