How do I configure a GitHub Actions workflow so it does not run on a tag push?

Advertisements

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?

>Solution :

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 * * *'

The docs say:

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

Leave a ReplyCancel reply