You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/modules/orchestrate/pages/github-trigger-event-options.adoc
+52-16Lines changed: 52 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,12 +91,55 @@ a| * `opened`
91
91
92
92
All pipelines triggered by link:https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request[pull request events] also have the following xref:reference:ROOT:variables.adoc#pipeline-values[pipeline values] populated:
93
93
94
-
* `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.
95
-
* `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.
96
-
* `pipeline.event.github.pull_request.draft`: a boolean value indicating whether the pull request is a draft.
97
-
+
98
-
**Example**: To trigger a pipeline on `PR opened or pushed to, default branch and tag pushes`, and ensure that it never runs if the event is associated with a draft PR, use the following:
99
-
+
94
+
[NOTE]
95
+
====
96
+
If your config contains a logical statement referencing any of the pipeline values listed below, you must do one of the following to prevent the pipeline creation from failing:
97
+
98
+
* Ensure your triggers only allow pull request related events.
99
+
* Include a condition to ensure that the pipeline only runs for pull request related events: `pipeline.event.name == "pull_request"`.
100
+
====
101
+
102
+
[cols=".^1,1"]
103
+
|===
104
+
|Pipeline value |Description
105
+
106
+
|`pipeline.event.github.pull_request.base.ref`
107
+
|The name of the *base* (or target) branch of the PR - that is the branch that will receive the changes.
108
+
109
+
|`pipeline.event.github.pull_request.head.ref`
110
+
|The name of the *head* branch of the PR - that is the branch containing the changes to be merged.
111
+
112
+
|`pipeline.event.github.pull_request.draft`
113
+
|A boolean value indicating whether the pull request is a draft.
114
+
115
+
|`pipeline.event.github.pull_request.title`
116
+
|The title of the pull request.
117
+
118
+
|`pipeline.event.github.pull_request.number`
119
+
|The numeric identifier of the pull request.
120
+
121
+
|`pipeline.event.github.pull_request.merged`
122
+
|A boolean that indicates whether the PR was merged or not.
123
+
|===
124
+
125
+
These values are extracted directly from the GitHub event payload. The part after prefix `pipeline.event.github.*` matches the corresponding field in the pull request event structure described in link:https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request[the GitHub docs].
126
+
127
+
**Examples**:
128
+
129
+
If the trigger option is `PR opened or pushed to, default branch and tag pushes`, include the additional condition `pipeline.event.name == "pull_request"` to prevent the pipeline creation from failing on a `push` event:
130
+
131
+
[,yaml]
132
+
----
133
+
workflows:
134
+
say-hello-workflow:
135
+
when: pipeline.event.name == "pull_request" and pipeline.event.github.pull_request.number == 23
136
+
jobs:
137
+
- say-hello
138
+
----
139
+
140
+
141
+
To trigger a pipeline on `PR opened or pushed to, default branch and tag pushes`, and ensure that it never runs if the event is associated with a draft PR, use the following:
142
+
100
143
[,yaml]
101
144
----
102
145
workflows:
@@ -105,17 +148,10 @@ workflows:
105
148
jobs:
106
149
- myjob
107
150
----
108
-
+
109
-
** The condition `pipeline.event.github.pull_request.draft == false` excludes draft PRs from triggering the workflow.
110
-
** `pipeline.event.name == "api"` ensures that the workflow runs when triggered manually via the web app or API.
111
-
** `pipeline.event.name == "push"` ensures that the workflow runs when triggered via push to the default branch.
112
151
113
-
114
-
* `pipeline.event.github.pull_request.title`: the title of the pull request.
115
-
* `pipeline.event.github.pull_request.number`: the numeric identifier of the pull request.
116
-
* `pipeline.event.github.pull_request.merged`: a boolean that indicates whether the PR was merged or not.
117
-
118
-
These values are extracted directly from the GitHub event payload. The part after prefix `pipeline.event.github.*` matches the corresponding field in the pull request event structure described in link:https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request[the GitHub docs].
152
+
* `pipeline.event.github.pull_request.draft == false` excludes draft PRs from triggering the workflow.
153
+
* `pipeline.event.name == "api"` ensures that the workflow runs when triggered manually via the web app or API.
154
+
* `pipeline.event.name == "push"` ensures that the workflow runs when triggered via push to the default branch.
119
155
120
156
Config orchestration tools are available from within your pipelines are as follows:
0 commit comments