Skip to content

Commit 21d5c66

Browse files
authored
Update README
- Add doc update to mention the new feature - Prepare for next release
1 parent 0bc7e32 commit 21d5c66

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

README.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ For example, in the following configuration:
4545
steps:
4646
- label: "Triggering pipelines"
4747
plugins:
48-
- monorepo-diff#v1.4.0:
48+
- monorepo-diff#v1.5.0:
4949
diff: "git diff --name-only HEAD~1"
5050
watch:
5151
- path: "**/*"
@@ -70,14 +70,15 @@ This is a sub-section that provides configuration for running commands or trigge
7070
- [Trigger](https://buildkite.com/docs/pipelines/configure/step-types/trigger-step)
7171
- [Command](https://buildkite.com/docs/pipelines/configure/step-types/command-step)
7272
- [Group](https://buildkite.com/docs/pipelines/configure/step-types/group-step)
73+
- [Conditionals](https://buildkite.com/docs/pipelines/conditionals)
7374

7475
:warning: This plugin may accept configurations that are not valid pipeline steps, this is a known issue to keep its code simple and flexible.
7576

7677
```yaml
7778
steps:
7879
- label: "Triggering pipelines"
7980
plugins:
80-
- monorepo-diff#v1.4.0:
81+
- monorepo-diff#v1.5.0:
8182
watch:
8283
- path: app/
8384
config:
@@ -108,7 +109,7 @@ steps:
108109
steps:
109110
- label: "Triggering pipelines with plugin"
110111
plugins:
111-
- monorepo-diff#v1.4.0:
112+
- monorepo-diff#v1.5.0:
112113
watch:
113114
- path: test/.buildkite/
114115
config: # Required [trigger step configuration]
@@ -127,6 +128,34 @@ steps:
127128
- When changes are detected in the path `test/.buildkite/` it triggers the pipeline `test-pipeline`
128129
- If the changes are made to either `app/` or `app/bin/service/` it triggers the pipeline `data-generator`
129130

131+
**Conditional Step Execution (`if`):**
132+
133+
The plugin supports conditional execution of pipeline steps using the `if` key, matching Buildkite’s pipeline conditional syntax. The `if` key allows you to control when a step runs, based on branch names, environment variables, build metadata, or custom expressions.
134+
135+
**Example**
136+
137+
```yaml
138+
steps:
139+
- label: "Triggering pipelines with plugin"
140+
plugins:
141+
- monorepo-diff#v1.5.0:
142+
diff: git diff --name-only HEAD~1
143+
watch:
144+
- path: services/api
145+
config:
146+
trigger: deploy-api
147+
if: build.branch == 'main' || build.branch =~ /^release\//
148+
- path: services/web
149+
config:
150+
command: echo "Deploy Web"
151+
if: build.tag != null
152+
```
153+
154+
In the example above,
155+
- The `deploy-api` trigger will only run on the main branch or branches matching `release/*`.
156+
- The `web deployment` command will run only if the build has a tag.
157+
158+
130159
#### `diff` (optional)
131160

132161
This will run the script provided to determine the folder changes.
@@ -172,7 +201,7 @@ git diff --name-only "$LATEST_TAG"
172201
steps:
173202
- label: "Triggering pipelines"
174203
plugins:
175-
- monorepo-diff#v1.4.0:
204+
- monorepo-diff#v1.5.0:
176205
diff: "git diff --name-only HEAD~1"
177206
watch:
178207
- path: "bar-service/"
@@ -199,7 +228,7 @@ A default `config` to run if no paths are matched, the `config` key is not requi
199228
steps:
200229
- label: "Triggering pipelines"
201230
plugins:
202-
- monorepo-diff#v1.4.0:
231+
- monorepo-diff#v1.5.0:
203232
diff: "git diff --name-only HEAD~1"
204233
watch:
205234
- path: "bar-service/"
@@ -221,7 +250,7 @@ The object values provided in this configuration will be appended to `env` prope
221250
steps:
222251
- label: "Triggering pipelines"
223252
plugins:
224-
- monorepo-diff#v1.4.0:
253+
- monorepo-diff#v1.5.0:
225254
diff: "git diff --name-only HEAD~1"
226255
watch:
227256
- path: "foo-service/"
@@ -243,7 +272,7 @@ Add `log_level` property to set the log level. Supported log levels are `debug`
243272
steps:
244273
- label: "Triggering pipelines"
245274
plugins:
246-
- monorepo-diff#v1.4.0:
275+
- monorepo-diff#v1.5.0:
247276
diff: "git diff --name-only HEAD~1"
248277
log_level: "debug" # defaults to "info"
249278
watch:
@@ -274,7 +303,7 @@ By setting `wait` to `true`, the build will wait until the triggered pipeline bu
274303
steps:
275304
- label: "Triggering pipelines"
276305
plugins:
277-
- monorepo-diff#v1.4.0:
306+
- monorepo-diff#v1.5.0:
278307
diff: "git diff --name-only $(head -n 1 last_successful_build)"
279308
interpolation: false
280309
env:

0 commit comments

Comments
 (0)