【问题标题】:How to run multiple GitHub Actions workflows from sub directories如何从子目录运行多个 GitHub Actions 工作流
【发布时间】:2021-01-08 13:38:12
【问题描述】:

我在./github/workflows/ 中有 3 个目录

  • 短绒
  • 功能测试
  • 单元测试

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

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

我该如何解决这个问题?

【问题讨论】:

  • 您找到解决方案了吗?我也想知道。

标签: github workflow github-actions


【解决方案1】:

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

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

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


您可以使用复合运行步骤操作 (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...]

【讨论】:

猜你喜欢
  • 2020-04-02
  • 2022-01-13
  • 2023-01-05
  • 2022-01-10
  • 2020-03-20
  • 1970-01-01
  • 2020-12-17
  • 2022-01-10
  • 2023-01-11
相关资源
最近更新 更多