Skip to content

Commit 9bec5d2

Browse files
docs(prompts): add on.pr trigger documentation to create-ado-agentic-workflow.md (#581)
Step 11 only documented on.pipeline triggers. The on.pr trigger is fully implemented (PrTriggerConfig with branches/paths/filters) and documented in docs/front-matter.md, but was entirely absent from the workflow creation prompt that agents use. - Rename Step 11 to 'Triggers (optional)' to cover both trigger types - Add on.pr section with full example (branches, paths, runtime filters) - Add explanation of how on.pr generates native ADO pr: block + gate step - Fix 'PR-Triggered Code Review' common pattern to actually use on.pr (it previously used on.pipeline, which contradicted the pattern name) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8029980 commit 9bec5d2

1 file changed

Lines changed: 54 additions & 8 deletions

File tree

prompts/create-ado-agentic-workflow.md

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,50 @@ permissions:
377377
| Both | Agent can read; safe-outputs can write |
378378
| Neither | No ADO tokens anywhere |
379379

380-
### Step 11 — Pipeline Triggers (optional)
380+
### Step 11 — Triggers (optional)
381+
382+
#### PR Triggers (`on.pr`)
383+
384+
Trigger on pull request events. Use `branches:` and `paths:` for native ADO filtering; use `filters:` for runtime gate conditions evaluated in the Setup job.
381385

382-
Trigger from another pipeline:
386+
```yaml
387+
on:
388+
pr:
389+
branches:
390+
include: [main] # only PRs targeting main
391+
# exclude: [release/*]
392+
paths:
393+
include: [src/*] # only PRs touching src/
394+
filters: # optional runtime filters (compiled to gate step with self-cancellation)
395+
title: "*[review]*" # glob match on PR title
396+
author:
397+
include: ["alice@corp.com"]
398+
# exclude: ["bot@corp.com"]
399+
draft: false # omit to match both draft and non-draft
400+
labels:
401+
any-of: ["run-agent"] # PR must have at least one of these labels
402+
# all-of: [...] # PR must have ALL of these labels
403+
# none-of: [...] # PR must have NONE of these labels
404+
source-branch: "feature/*" # glob on PR source branch
405+
target-branch: "main" # glob on PR target branch
406+
commit-message: "*[skip-agent]*" # cancel if latest commit message matches
407+
changed-files:
408+
include: ["src/**/*.rs"]
409+
min-changes: 1 # minimum number of changed files
410+
max-changes: 100 # maximum number of changed files
411+
time-window:
412+
start: "09:00"
413+
end: "17:00"
414+
build-reason:
415+
include: [PullRequest]
416+
expression: "eq(variables['Custom.Flag'], 'true')" # raw ADO condition
417+
```
418+
419+
When `on.pr` is set: the native ADO `pr:` trigger block is generated from `branches:` and `paths:`. Runtime `filters:` compile to a gate step in the Setup job that self-cancels the build when they do not match.
420+
421+
#### Pipeline Triggers (`on.pipeline`)
422+
423+
Trigger from another pipeline completing:
383424
```yaml
384425
on:
385426
pipeline:
@@ -662,21 +703,26 @@ safe-outputs:
662703
663704
### PR-Triggered Code Review
664705
665-
Triggered by another pipeline; reviews and comments via ADO.
706+
Triggered when a pull request is opened or updated; reviews and comments via ADO.
666707
667708
```yaml
668709
on:
669-
pipeline:
670-
name: "CI Build"
671-
branches: [main, feature/*]
710+
pr:
711+
branches:
712+
include: [main]
713+
filters:
714+
draft: false # Skip draft PRs
672715
tools:
673716
azure-devops: true
674717
permissions:
675718
read: my-read-sc
676719
write: my-write-sc
677720
safe-outputs:
678-
create-work-item:
679-
work-item-type: Task
721+
add-pr-comment:
722+
max: 5
723+
noop:
724+
work-item:
725+
enabled: false
680726
```
681727
682728
### Repository Maintenance with PRs

0 commit comments

Comments
 (0)