Skip to content

Commit a4aec6e

Browse files
authored
Replace script with CmdLine task in YAML examples
Injecting script tasks using the `- script` option fails with the error `Unexpected value 'script'`. Replacing it with the explicit `CmdLine@2` task as shown in the initial example works as expected
1 parent 1d5d508 commit a4aec6e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/extend/develop/add-pipeline-decorator.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ The updated file looks like this:
143143
```yaml
144144
steps:
145145
- ${{ if eq(resources.repositories['self'].ref, resources.repositories['self'].defaultBranch) }}:
146-
- script: dir
146+
- task: CmdLine@2
147147
displayName: 'Run my script (injected from decorator)'
148+
inputs:
149+
script: dir
148150
```
149151

150152
You can start to see the power of this extensibility point.
@@ -165,8 +167,10 @@ If we see another script task, we shouldn't inject ours.
165167
```yaml
166168
steps:
167169
- ${{ if and(eq(resources.repositories['self'].ref, resources.repositories['self'].defaultBranch), not(containsValue(job.steps.*.task.id, 'd9bafed4-0b18-4f58-968d-86655b4d2ce9'))) }}:
168-
- script: dir
170+
- task: CmdLine@2
169171
displayName: 'Run my script (injected from decorator)'
172+
inputs:
173+
script: dir
170174
```
171175

172176
## 5. Specify a target task

0 commit comments

Comments
 (0)