工作流程未触发第二个工作流程 [英] A workflow is not triggering a second workflow

查看:70
本文介绍了工作流程未触发第二个工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在其中完成推送时,文件 inrisk.packages.ci.yml 中的工作流程会生成代码的 tag realise . develop 分支.以下按预期方式工作.

 名称:Code整数上:推:路径:-'infra/**'职位:ci:运行:ubuntu-latest脚步:#签出到$ GITHUB_WORKSPACE-用途:actions/checkout @ v2-名称:基本检查运行:我是谁ls -lah密码-使用:actions/setup-node @ v1#在开发中创建一个新版本以触发部署-名称:凹凸版本和标签如果:github.ref =='refs/heads/develop'用途:mathieudutour/github-tag-action@v4.5id:tag_version环境:GITHUB_TOKEN:$ {{secrets.GITHUB_TOKEN}}-名称:创建发布如果:github.ref =='refs/heads/develop'id:create_release用途:actions/create-release @ v1环境:GITHUB_TOKEN:$ {{secrets.GITHUB_TOKEN}}和:tag_name:$ {{steps.tag_version.outputs.new_tag}}release_name:释放$ {{steps.tag_version.outputs.new_tag}}草稿:错误预发布:false 

文件 inrisk.packages.cd.yml 中的以下工作流程,并假定在 tag / realise 已创建/已发布.

 名称:代码部署上:推:标签:-'v *'释放:类型:-发布-创建-发布职位:构建和部署:运行:ubuntu-latest脚步:#签出到$ GITHUB_WORKSPACE-用途:actions/checkout @ v2-使用:actions/setup-node @ v1-名称:Install Yarn运行:npm install -g yarn-用途:chrislennon/action-aws-cli@v1.1-名称:安装,构建和部署运行:我是谁ls -lah密码 

第二个工作流 Code部署 Code Int 发布/创建 后未触发标签/实现

但是,当我手动创建 realise / tag 时,第二个工作流程 Code Deploy 被触发

解决方案

这似乎是设计使然,如文章来解决问题

The workflow in file inrisk.packages.ci.yml generates a tag and a realise of the code when a push is done in the develop branch. The below works as expected.

name: Code Int

on:
  push:
    paths:
      - 'infra/**'

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      # Checks-out to $GITHUB_WORKSPACE
      - uses: actions/checkout@v2
      - name: Basic Checks
        run: |
          whoami
          ls -lah
          pwd
      - uses: actions/setup-node@v1
      # Create a new release when on develop which triggers the deployment
      - name: Bump version and push tag
        if: github.ref == 'refs/heads/develop'
        uses: mathieudutour/github-tag-action@v4.5
        id: tag_version
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Create Release
        if: github.ref == 'refs/heads/develop'
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ steps.tag_version.outputs.new_tag }}
          release_name: Release ${{ steps.tag_version.outputs.new_tag }}
          draft: false
          prerelease: false

The below workflow in file inrisk.packages.cd.yml and is suppose to be triggered when ever a tag/realise is created/published.

name: Code Deploy

on:
  push:
    tags:
      - 'v*'
  release:
    types:
      - published
      - created
      - released

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      # Checks-out to $GITHUB_WORKSPACE
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
      - name: Install Yarn
        run: npm install -g yarn
      - uses: chrislennon/action-aws-cli@v1.1
      - name: Install, Build and Deploy
        run: |
          whoami
          ls -lah
          pwd

The second workflow Code Deploy dose not get trigger after Code Int publishes/created a tag/realise

However when I manually create a realise/tag the second workflow Code Deploy get triggered

解决方案

This seems to be by design as stated here .This is to stop recursive workflow runs.

I used this article to get around the problem

这篇关于工作流程未触发第二个工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆