'How can I not execute a GitHub Action when I push a new tag?
I want that my GitHub Action that runs all tests doesn't execute when we push a new tag to the master repository because when we merge new branches we execute this action before, and when we push a tag to create a new release this action executes again.
Right now this action starts with this
name: Build and Test
on: push
As you see this will execute in every push we would make, and I want to change that this action will execute only when we push commits, no tags. My approximate solution would be this but I am not sure
name: Build and Test
on:
push:
branches:
- '*'
tags-ignore:
- '*'
Solution 1:[1]
That should work, but I'd recommend two improvements.
First, use **
instead of *
(the edge case here is a branch/tag named /
).
Second, omit the tags-ignore
clause. In my testing, Github ignores all tags if you specify branches
but not tags
or tags-ignore
.
name: Build and Test
on:
push:
branches:
- '**'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | pschale |