You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改GitHub Action Workflow条件,避免添加auto:deploy标签时触发销毁任务

调整方案

你只需要在原有条件最前面新增一行排除「添加auto:deploy标签」场景的判断即可,修改后的完整配置如下:

if: |
  ! (github.event.action == 'labeled' && github.event.label.name == 'auto:deploy') &&
  (needs.changed.outputs.stack_workspace) &&
  (
    (github.event.action == 'edited' && contains(github.event.pull_request.body, '/teardown')) ||
    (
      contains('unlabeled closed', github.event.action) && 
        (
          github.event.label.name == 'auto:deploy' || 
          contains(github.event.pull_request.labels.*.name, 'auto:deploy')
        )
    )
  )

修改说明

  • 新增的! (github.event.action == 'labeled' && github.event.label.name == 'auto:deploy')逻辑会直接过滤掉给PR添加auto:deploy标签的触发场景,完全不会影响你要保留的三类触发逻辑:
    • PR被编辑且正文包含/teardown
    • 移除auto:deploy标签
    • PR关闭
  • 原有所有其他触发逻辑没有做任何改动,不会出现兼容问题。

内容的提问来源于stack exchange,提问作者Tom

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 14:36:04