Skip workflow if commit is tagged

I want to skip a workflow execution if a tagged commit is pushed (since tagged commits are being handled by semantic release in my case and should not trigger the workflow), to do so I used the “tags-ignore” option as explained here 

Here is my workflow config:

name: Deploy

on:
  push:
    tags-ignore:
      - '**'
    branches:
      - master
  jobs:
    deploy:
    ...

When a tagged commit is pushed, this workflow is still being run, despite matching the pattern as described here 

Any suggestions why?

The current workaround I’m using is a conditional at the job level:

name: Deploy
on:
  push:
    tags-ignore:
      - '**'
    branches:
      - master
jobs:
  deploy:
    if: contains(github.event.head_commit.message, 'skip ci') == false
    ...

I suppose I could achieve something similar comparing the tag name in a similar conditional, however I wanted to avoid execution at the workflow level instead. Currently when the above condition is true, the job does not run, but the workflow still appears listed in the actions tab (with a grey icon indicator indicating it has being skipped).

4 Likes

Hi @amalv,

Thank you for being here and apologies for the super delayed response. A couple of things for the tags-ignore issue do you have a public repo you can share with the error. We’ve attempted to reproduce to no avail. As far as using the if conditional I’ve fed this back to our team to consider as feedback, but cannot promise if or when any changes might occur.

Thanks again for reaching out!

Hi Andrea,
we experience the same, cf orchestra-maven-plugin/.github/workflows at master · baloise/orchestra-maven-plugin · GitHub

For the tagged commits ( releases ) both workflows run, ie. 310912167 and 310913187 were triggered by the same commit beb3d21d2d765

Kind regards,
Matthias

@culmat: those two workflows don’t have the same branches/tags-ignores.

My guess is that @amalv was triggering work on master, but it’s hard to be sure.