另一个作业的Github操作中的If条件

另一个作业的Github操作中的If条件,github,continuous-integration,github-actions,Github,Continuous Integration,Github Actions,我的用例是,当Pull请求注释中有一个触发词时触发docs build。 我用来知道代码中是否存在触发字 在知道动作被触发后,我想在repo内部运行一些命令。所以,我必须使用它 我的疑问是,在run命令中,只有Shell命令是有效的,对吗?如果满足上述条件,我想运行另一个作业 我当前的Yaml文件 name:测试GH动作 关于: 拉拽请求: 类型:[已打开] 工作: 部署: 运行于:ubuntu最新版本 步骤: -用法:khan/pull请求注释-trigger@master id:支票 与:

我的用例是,当Pull请求注释中有一个触发词时触发docs build。 我用来知道代码中是否存在触发字

在知道动作被触发后,我想在repo内部运行一些命令。所以,我必须使用它

我的疑问是,在
run
命令中,只有Shell命令是有效的,对吗?如果满足上述条件,我想运行另一个作业

我当前的Yaml文件

name:测试GH动作
关于:
拉拽请求:
类型:[已打开]
工作:
部署:
运行于:ubuntu最新版本
步骤:
-用法:khan/pull请求注释-trigger@master
id:支票
与:
触发器:“AppajiC”
反应:火箭
环境:
GITHUB_令牌:“${{secrets.GITHUB_令牌}”
-运行:
#通常,如果满足以下条件,这里的任何内容都会运行。
#我想在这里运行另一个作业,它使用操作/checkout@v2行动
if:steps.check.outputs.triggered==“true”

如何实现这一点?

您可以使用结帐步骤的条件以及以下步骤:

- name: Checkout
  uses: actions/checkout@v2
  if: steps.check.outputs.triggered == 'true'

- name: Following step1
  if: steps.check.outputs.triggered == 'true'

...
或者,您可以创建一个新作业并使用该条件一次:

jobs:
  deploy:
    runs-on: ubuntu-latest
    outputs:
      deploy-status: ${{ steps.check.outputs.triggered }}
    steps:
      - uses: khan/pull-request-comment-trigger@master
        id: check
        with:
          trigger: 'AppajiC'
          reaction: rocket
        env:
          GITHUB_TOKEN: ${{ github.token }}

  # this job will only run if steps.check.outputs.triggered == 'true'
  # you just need to write the if once
  after-deploy:
    runs-on: ubuntu-latest
    needs: [deploy]
    if: needs.deploy.outputs.deploy-status == 'true'
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        
      ...

您可以在签出步骤中使用相同的if条件。或者,您可以为整个作业创建一个具有该if条件的新作业,这样您就不需要为每个步骤重复if。您能给出一个示例片段吗?