Github Actions: how to conditionally run individual jobs based on specific path changes?
22:01 27 Dec 2025

I'm coming from the Gitlab world and if I want to conditionally run an entire CI file based on certain changes, I'd use include[*].rules.changes:

include:
  - local: .gitlab/ci/file.yml
    rules:
      - changes:
          - myfile.py

In Github Actions, this is akin to the on rules:

on:
  push:
    paths:
      - myfile.py

Then in Gitlab CI, I can additionally modify whether or not an individual job runs with a similar method:

myjob:
  script: python myfile.py
  rules:
    - changes:
        - myfile.py

But I can't seem to find any comparable functionality in Github Actions, and I can't figure out a strategy that would replicate this. Maybe something like this?

on:
  push:
    paths:
      - myfile.py
jobs:
  myjob:
    steps:
      - uses: ./.github/workflows/file.yml

Then .github/workflows/file.yml:

on:
  workflow_call:
jobs:
  otherjob:
    steps:
      - run: python myfile.py

But this obviously complicates the locality of behavior and makes it more complicated to do things like needs, etc. to reference other jobs since they're in 2 separate workflows.

The objective would be to be able to structure all my jobs for (for example) a release pipeline within a single workflow file and there are certain jobs that only run if, say, file myfile.py is changed.

Is there a way to accomplish this sort of thing in Github Actions?

github-actions