How to only trigger on changes to specific file(s)

Drone has several conditions to trigger off. Is there one that will trigger off changes to specific files or dirs ? Main example would be to NOT trigger when is changed, only when the main repo files change.

Using gitlab only: changes: type syntax maybe ?

Very annoying to have a pipeline run when a 2-word change to is pushed.

1 Like

Hi @Halfwalker!
All Drone triggers are content-independent. As a workaround you may use exit 78 command to exit your pipeline stages before compilation steps. Here is an example:

kind: pipeline
type: docker
name: default

- name: trigger
  image: plugins/git
  - test $DRONE_BUILD_EVENT = pull_request
    && DIFF_STRING=origin/${DRONE_COMMIT_BRANCH:-master}
  - git --no-pager diff --name-only $DIFF_STRING
    | grep -q -e ^[.]drone[.] -e ^Makefile$ -e [.]c$
    || exit 78

- name: build
  image: gcc
  - make

- name: test
  image: gcc
  - ./test


If you want to limit pipeline or pipeline step execution based on files changed, you can install an extension for this. See

Yeah, I saw that, thanks. Unfortunately it does’t support Gitea (yet).