Reputation: 9887
I'd like to configure a GitHub Actions workflow so that it runs on branch pushes, but not tag pushes. I thought this would work:
on:
push:
tags-ignore: ['**']
But then the workflow failed to run when I pushed a branch, too. Is there a way to configure it so that it runs on a branch push but not a tag push?
Upvotes: 8
Views: 2672
Reputation: 13931
Unintuitively, to avoid the tags, you have to tell it to run on all the branches instead. See its use in psycopg for instance.
on:
push:
branches:
- "*"
pull_request:
schedule:
- cron: '48 6 * * *'
If you define only tags/tag-ignore or only branches/branches-ignore, the workflow won't run for events affecting the undefined Git ref.
Upvotes: 13