'Run Github actions in monorepo

I have a project which contains 2 folder: backend and frontend. In each folder i added the corresponded project, each project has its own package.json. Also in each folder/project i have .github with sett workflow/file.yml where is sett github actions for backend and also for frontend
EX: 1. frontend/.github/workflows/file.yml and 2. backend/.github/workflows/file.yml.backend folder is the root and frontend is located inside it.
Now if i push my changes being in backend folder i trigger only BE github actions, but i also need to run the frontend actions.
Question: Does somebody face this kind of issue and how to run both github actions?



Solution 1:[1]

You can run many workflows at same time, as you want.

  • You must have a .github/workflows folder, where your actions will be;
  • Each file must have a on clause
  • Use cd backend and cd frontend to access file on subdirectories during the action
  • You can add some pwd && ls to check if you are on right directory

It's enough to run more than on action, for the back and the front.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tiago Gouvêa