Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run multiple GitHub Actions workflows from sub directories

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?

like image 573
talhaamir Avatar asked Sep 17 '25 03:09

talhaamir


1 Answers

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...]
like image 148
riQQ Avatar answered Sep 19 '25 19:09

riQQ