如何配置 GitHub Actions 工作流程,使其不在标签推送上运行?

the*_*ory 4 github github-actions

我想配置 GitHub Actions 工作流程,以便它在分支推送上运行,但不在标签推送上运行。我认为这会起作用:

on:
  push:
    tags-ignore: ['**']
Run Code Online (Sandbox Code Playgroud)

但当我推送分支时,工作流程也无法运行。有没有办法配置它,使其在分支推送上运行,而不是在标签推送上运行?

pir*_*iro 9

不直观的是,为了避免标签,您必须告诉它在所有分支上运行。例如,请参阅它在 psycopg 中的使用。


on:
  push:
    branches:
      - "*"
  pull_request:
  schedule:
    - cron: '48 6 * * *'
Run Code Online (Sandbox Code Playgroud)

文档说

如果您仅定义tags/tag-ignore或仅定义branches/branches-ignore,则对于影响未定义的Git引用的事件,工作流将不会运行。