4

I have 3 directories in ./github/workflows/

  • linters
  • functionalTests
  • unitTests

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?

riQQ
  • 9,878
  • 7
  • 49
  • 66
talhaamir
  • 99
  • 2
  • 15

1 Answers1

10

You can't run workflows from subdirectories:

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

Source: https://docs.github.com/en/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...]
riQQ
  • 9,878
  • 7
  • 49
  • 66