2

I have the following action:

name: Run after changing anything in myPath package
on:
  pull_request:
  push:
    paths:
      - 'myPath/**'

This action runs when something is pushed under myPath but also on any pull request.

How I can limit this action to pull requests that contain changes under myPath?

pixel
  • 24,905
  • 36
  • 149
  • 251
  • You can use the `paths` for `pull_request` trigger as well, the same way you did for the `push` trigger: ```pull_request: paths: - 'myPath/**'``` as explained on the first paragraph from this section on the official documentation: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore – GuiFalourd Jan 27 '22 at 19:44

1 Answers1

2

You have to repeat paths for each event type.

name: Run after changing anything in myPath package
on:
  pull_request:
    paths:
      - 'myPath/**'
  push:
    paths:
      - 'myPath/**'
Grzegorz Krukowski
  • 18,081
  • 5
  • 50
  • 71