Github action for master branch and ignore all tags and first level of files

Hi,

I am having trouble configuring this workflow. I want to trigger a dev workflow, when anything is pushed to master branch, except if the commit is tagged and if the changes were only made on the root directory (so that it does not trigger a new build if I only change the README.md)

I have been trying this, but it triggers everytime… Any thoughts?

on:
  push:
    branches:
      - master
    tags-ignore:
      - '**'
    paths-ignore:
      - '*'

Thanks!

From what I understand, branches, tags*, and paths* are independent triggers. Therefore the trigger works if at least one condition coincides.

You can go from the opposite.

on:
  push:
    paths:
      - '*/**'  # Run on non-root changes
jobs:
  some-job:
    if: ${{ github.ref == 'refs/heads/master' }}
    # ...

or try to use some actions like dorny/paths-filter.

So the on: works as OR conditions…
But the way you put it, it will still run even if the commit is tagged. I would like to add an and commit is not tagged equivalent.

Thanks

The documentation says this:

If you define only tags or only branches , the workflow won’t run for events affecting the undefined Git ref.

As I understand it (and have seen where I use branch filters) setting a branches filter means that the workflow won’t run for tags unless you also have tags or tags-ignore.

If you put just for master branch, it will still run for tagged pushes to master

It will run for the push to master, but not for pushing the tag.

There is no reliable way to exclude other references (tags, other branches) to a commit: You could create a job that checks if there is a tag matching the commit the workflow is currently running for, but that only works if the other reference has been pushed by the time the fetch for that check happens.