Skip to content

Commit e35bad4

Browse files
Update github-trigger-event-options.adoc (#9592)
* Update github-trigger-event-options.adoc * Update github-trigger-event-options.adoc * Update github-trigger-event-options.adoc * Update github-trigger-event-options.adoc * Update github-trigger-event-options.adoc * Update github-trigger-event-options.adoc * formatting fix --------- Co-authored-by: Rosie Yohannan <[email protected]>
1 parent 417cb64 commit e35bad4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/guides/modules/orchestrate/pages/github-trigger-event-options.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ All pipelines triggered by link:https://docs.github.com/en/webhooks/webhook-even
9494
* `pipeline.event.github.pull_request.base.ref`: the name of the *base* (or target) branch of the PR - that is the branch that will receive the changes.
9595
* `pipeline.event.github.pull_request.head.ref`: the name of the *head* branch of the PR - that is the branch containing the changes to be merged.
9696
* `pipeline.event.github.pull_request.draft`: a boolean value indicating whether the pull request is a draft.
97+
+
98+
**Usage example**: To trigger a pipeline on _PR opened or pushed to, default branch and tag pushes_, but ensure that it never runs if the event is associated with a PR that is marked as draft, use the following filter.
99+
+
100+
** The condition `pipeline.event.github.pull_request.draft == false` excludes draft PRs from triggering the workflow.
101+
** `pipeline.event.name == "api"` ensures that the workflow runs when triggered manually via the web app or API.
102+
** `pipeline.event.name == "push"` ensures that the workflow runs when triggered via push to the default branch.
103+
+
104+
[,yaml]
105+
----
106+
workflows:
107+
my-workflow:
108+
when: pipeline.event.name == "api" or pipeline.event.name == 'push' or (pipeline.event.name == "pull_request" and pipeline.event.github.pull_request.draft == false))
109+
jobs:
110+
- myjob
111+
----
112+
97113
* `pipeline.event.github.pull_request.title`: the title of the pull request.
98114
* `pipeline.event.github.pull_request.number`: the numeric identifier of the pull request.
99115

0 commit comments

Comments
 (0)