为什么我的 github 操作不会在正则表达式标记上触发

Why doesn't my github action trigger on a regex tag

我第一次尝试 Github 操作时,我需要根据 git 标签触发,例如 1.2.3-RELEASE,这看起来很常见。我可以找到这样的例子:

on:
  push:
    tags:        
      - v1             # Push events to v1 tag
      - v1.*           # Push events to v1.0, v1.1, and v1.9 tags

所以我创建了这样的 yaml 文件:

on:
  push:
    tags: 
      - '[1-9]+.[0-9]+.[0-9]+\-RELEASE'

但它永远不会触发。我使用在线工具验证了正则表达式,并尝试使用第一个示例设置的标签 v1.1,无论是否使用引号都可以。我的表达式需要引号,这很好,但不起作用。有人知道我在这里做错了什么吗?

GitHub Action syntax doc确实提到:

The branches, branches-ignore, tags, and tags-ignore keywords accept glob patterns that use the * and ** wildcard characters to match more than one branch or tag name.
For more information, see the "Filter pattern cheat sheet".

所以普通的正则表达式是行不通的。
您的表达式足够接近 glob 模式:我会尝试 not 转义 -:

[1-9]+.[0-9]+.[0-9]+-RELEASE