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

标签 github workflow github-actions

我在 ./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/

    相关文章:

    git - 使用git describe使Git在分支上显示正确的标签

    sql-server - 数据库批准拒绝工作流程

    状态机工作流中的 SharePoint 修改表单

    sql - 自动化 Azure SQL 数据库部署时如何处理环境特定的安全权限?

    opencv - 如何检查 GitHub 存储库是否使用持续集成以及哪个 CI 平台(例如 Jenkins、Travis CI)?

    javascript - 我如何使用自己的 JavaScript 库处理 "think in QUnit"?

    git - 远程 : Repository not found

    git - 如何检查特定的 pull 请求

    workflow - Gerrit 工作流程 - 将单个提交推送到主题分支

    github-actions - GitHub 操作 : run if