Trigger Github Action only on new tags?

I got it to work with

on:
  push:
    tags:
      - '*'

I found out that if the tag was previously created (locally) before the workflow was created, no matter how many times I deleted and re-pushed the tag, it would not trigger until I deleted the tag locally and recreated it. The action does not seem to work for tags created before the workflow.


Use the following syntax:

on:
  push:
    # Pattern matched against refs/tags
    tags:        
      - '*'           # Push events to every tag not containing /

For hierarchical tags:

on:
  push:
    # Pattern matched against refs/tags
    tags:        
      - '**'           # Push events to every tag including hierarchical tags like v1.0/beta

https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags