Excluding .yaml and .md files from auto triggering the Jenkins build

In your job's configuration under the Build Triggers section, you should be able to find what you are looking for (usually under the Advanced tab). For example, on my instance of Jenkins, for the "GitHub Pull Request Builder" trigger type, after clicking the Advanced button, you can see an "Excluded regions" textbox with the following help description:

Each exclusion uses regular expression pattern matching, and must be separated by a new line.


The example above illustrates that if only html/jpeg/gif files have been committed to the GitHub repository a build will not occur. More information on regular expressions can be found here.

Other trigger types will have something similar to the notion of "Excluded regions".

Moreover, Jenkins has added functionality like this in various ways as discussed in resolved Jira tickets such as JENKINS-21418 and JENKINS-36614.

I hope that helps. I know that it isn't a global function in a Jenkins file, as per the question, but I think that it can be a viable solution to the problem in general.

Jenkins declarative language checkout presumably also cover excludedRegions which is the same option @entpnerd described in the GitHub Pull Request Builder plugin:


If set, and Jenkins is set to poll for changes, Jenkins will ignore any files and/or folders in this list when determining if a build needs to be triggered.

See a Jenkinsfile example in a similar stackoverflow question. Jira issue JENKINS-36195 requested for this functionality and JENKINS-36836 provided working and not working cases and why.

The reality is that it is not working and it is not planned to be included:

There have been some brief discussions about it, but there are no plans to address it

so I would go for Jenkins GUI polling configuration.