如何从子目录运行多个GitHub Actions工作流 [英] How to run multiple GitHub Actions workflows from sub directories

查看:576
本文介绍了如何从子目录运行多个GitHub Actions工作流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在./github/workflows/

  • 衬里
  • functionalTests
  • unitTests

在每个目录中,我都有多个工作流.yml文件,例如在linters/codeQuality.yml

In each of these directories I have multiple workflow .yml files for example in linters/codeQuality.yml

我的问题是,当发出拉取请求时,仅执行根目录中的工作流文件,而不执行这些目录中的工作流文件.

My issue is that when a pull request is made then only the workflows files in root are executed and not the workflow files in these diretories.

我该如何解决这个问题?

How can I solve this problem?

推荐答案

您不能从子目录运行工作流:

You can't run workflows from subdirectories:

您必须将工作流文件存储在存储库的.github/workflows目录中.

来源: https: //docs.github.com/zh-CN/actions/reference/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows

不过,您可以使用复合运行步骤操作(

You can however use composite run steps actions (documentation).

.github/workflows/workflow.yaml

[...]

jobs:
  myJob:
    name: My Job
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: ./.github/workflows/linters/codeQuality

[...]

.github/workflows/linters/codeQuality/action.yaml

name: "My composite action"
description: "Checks out the repository and does something"
runs:
  using: "composite"
  steps: 
  - run: |
      echo "Doing something"

  [other steps...]

这篇关于如何从子目录运行多个GitHub Actions工作流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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