'Github actions: Run step / job in a workflow if changes happen in specific folder

Is there any way for us to control what jobs/steps to run in a workflow based on the changes in a specific folder

Eg:

I have said, following folders in my git repo : a, b, c On every PR merge to my branch I will trigger a workflow. The workflow will execute jobs say, A -> B -> C. I want to run job A only if changes are present for folder "a/**", B for "b/**" and so on.

So, If in the PR changes only happen in "a/**"and "b/**" workflow will skip job execution for C, making the workflow run to be A->B



Solution 1:[1]

Yes: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#registry_package

This is the syntax:

on:
  push:
    paths:
      - 'a/**'
      - 'b/**'

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 mmomtchev