Issue with tag-ignore with versioning #25158
-
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:
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. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
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.
Thanks. |
Beta Was this translation helpful? Give feedback.
-
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 }}” Which was really helful in determining what was causing the trigger and how we needed to fix it. |
Beta Was this translation helpful? Give feedback.
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.
Thanks.