Issue with tag-ignore with versioning

We have a js monorepo and weve been using lerna to manage our versions. We tried to switch our CI/CD over to Github actions but running into an issue.

We have a work flow thats like: 

name: deploy
        branches: [master]
            - '*'

And one of the steps is to have lerna version and then put the build somewhere.

This works fine, however when lerna versions, it keeps track of the version in the package.json, so it will update the package.json with a newer value like “version”: “1.0.14”, then commit the package.json along with tags.

For some reason this is then causing the action to fire again, the tags-ignore is not working. I’ve tried all sorts of wildcards such as ‘**’ or ‘name*’ or ‘*.*’ all things that match the tags, and it still fires the action on the ‘update package.json/tag’ commit. I have a feeling its because this is a commit with a file change AND tagging, but I’m not sure. 

Hi @adadkins ,

Yes, this is by designed, commit the package.json along with tags will trigger the workflow.

Actually you can check the value of github.ref when the workflow triggered, if it shows like ‘refs/heads/Branchname’, it’s triggered by the file commit, if it shows like ‘refs/tags/v1.4.5’, it’s triggered by a tag.

echo ${{ github.ref }}



1 Like

Thank you, that was helpful. We were getting a tags ref and then a master ref as well.

If anyone else stumbles upon this post with a similar issue, you can add a logging step to your job and just echo the values to the console. 

echo “1) message: ${{ github.event.head_commit.message }}”
echo “2) event name: ${{ github.event_name }}”
echo “3) ref: ${{ github.ref }}”

Which was really helful in determining what was causing the trigger and how we needed to fix it.

1 Like