【问题标题】:running github actions on push of a tag not executing在推送未执行的标签时运行 github 操作
【发布时间】:2022-12-03 11:31:25
【问题描述】:

我是 yml 语言的新手,只是设置了一个手动运行良好的 github 操作流程,但是当我试图让它在推送特定标签时它不起作用:

我正在尝试让 yml 在执行之后执行

git commit -am "my commit"
git tag cicd11
git push

我的 .yml 以此开头:

on:
  push:
    tags:
      - cicd**

我已经阅读了很多关于 SO 的问题,但似乎没有人在推送标签,根据手册,这应该是可能的。 谢谢你。

【问题讨论】:

    标签: yaml github-actions


    【解决方案1】:

    您需要完全限定标签。根据文档:https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore

    A tag named v2 (refs/tags/v2)

    所以你可以试试**cicd**refs/tags/cicd**

    【讨论】:

    • 事实上,cicd** 是正确的,但我指定的标签不正确
    【解决方案2】:

    按照 myz540 的建议仔细阅读文档后,我意识到我的 yaml 是正确的,在推送期间需要的是 --tags,即:

    git commit -am "my commit"
    git tag cicd11
    git push --tags
    

    就是这样,yaml 保持不变:

    on:
      push:
        tags:
          - cicd**
    

    【讨论】:

      猜你喜欢
      • 2020-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-22
      • 2021-01-29
      • 2020-10-04
      • 1970-01-01
      • 2021-02-14
      相关资源
      最近更新 更多