Source Paths

Source paths can be used to specify source code paths that will trigger a job upon modification. This is done by using a sourcePaths keyword in your job definition as a string or array of strings. This can be useful for running workflows based on subdirectories in a monorepo.

Types of source paths

You can either specify subdirectories and/or specific files as source paths. To denote a subdirectory, leave a trailing slash (/) at the end. The path is relative to the root of the repository.

Example

Given a repository with the file structure depicted below:

┌── README.md
├── screwdriver.yaml
├── test/
│   └── ...
├── src/
│   ├── app/
│   │   ├── main.js
│   │   ├── ...
│   │   └── package.json
│   └── other/
│       └── ...
│
...

And the screwdriver.yaml:

jobs:
    main:
        image: node:6
        requires: [~pr, ~commit]
        sourcePaths: ["src/app/", "screwdriver.yaml"]
        steps:
            - echo: echo hi

In this example, the job main will be triggered if there are any changes to files under src/app/ or the screwdriver.yaml file (like on src/app/main.js, src/app/package.json, etc.). The main job will not, however, be triggered on changes to README.md, test/, or src/other/.

Caveats