I have one repo it has 3 yaml files for frontend, backend & admin frontend. Developer push on backend works on every time. My 3 yamls running but frontend & admin frontend folder code have no changes in that time i need only backend yaml only run remaining two yaml simply do nothing,
For my scenario if user pushes to backend code only backend ci only i need to run
How to configure that?
CodePudding user response:
You can achieve what you want by using the paths
subtype in each of your workflow triggers.
I recommend to check the Github official documentation for more details.
In your case, supposing that you have 3 folders following the structure below:
repository
|__ backend
|__ frontend
|__ admin_fronted
For each workflow, you could user the following implementation:
name: Backend
on:
push:
paths:
- 'backend/**'
jobs:
[ ... ]
name: Frontend
on:
push:
paths:
- 'frontend/**'
jobs:
[ ... ]
name: Admin Frontend
on:
push:
paths:
- 'admin_frontend/**'
jobs:
[ ... ]
That way, each push will trigger a workflow only if at least a file in the specific path has been updated.
Note that there is also a paths-ignore
subtype when you can use the opposite behavior if needed.