gpt4 book ai didi

github - 如何从子目录运行多个 GitHub Actions 工作流

转载 作者:行者123 更新时间:2023-12-04 16:39:33 25 4
gpt4 key购买 nike

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

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

  • 在每个目录中,我都有多个工作流程 .yml文件例如 linters/codeQuality.yml我的问题是,当发出拉取请求时,只会执行 root 中的工作流文件,而不是这些目录中的工作流文件。
    我怎么解决这个问题?

    最佳答案

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

    You must store workflow files in the .github/workflows directory of your repository.


    来源:
    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...]

    关于github - 如何从子目录运行多个 GitHub Actions 工作流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64009546/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com