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/actions-and-automations/create-self-service-experiences/create-self-service-experiences.md
+186-1Lines changed: 186 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,4 +165,189 @@ The basic structure of a self-service action looks like this (see key descriptio
165
165
166
166
## Examples
167
167
168
-
For complete examples of self-service actions using GitHub as the backend, check out the [guides section](/guides?tags=GitHub&tags=Actions).
168
+
For complete examples of self-service actions using GitHub as the backend, check out the [guides section](/guides?tags=GitHub&tags=Actions).
169
+
170
+
## Track self-service actions
171
+
172
+
To gain visibility into how your self-service actions are being used and their performance, you can set up tracking for action runs. This allows you to monitor execution patterns, track success rates, and maintain audit trails to follow what actions were executed and when.
173
+
174
+
The following tracking system works by creating a dedicated blueprint for action runs and setting up an automation that captures execution details whenever a specific self-service action is triggered as well as an automation that updates the action run's status.
175
+
176
+
<h3>Set up data model</h3>
177
+
178
+
Create a blueprint for `Action run`:
179
+
180
+
1. Go to the [Data model](https://app.getport.io/settings/data-model) page of your portal.
181
+
182
+
2. Click on `+ Blueprint`.
183
+
184
+
3. Click on the `{...} Edit JSON` button in the top right corner.
185
+
186
+
4. Copy and paste the following JSON schema, then click `Save`.
187
+
188
+
<details>
189
+
<summary><b>Action run blueprint (click to expand)</b></summary>
190
+
191
+
```json
192
+
{
193
+
"identifier": "action_run",
194
+
"title": "Action run",
195
+
"icon": "Microservice",
196
+
"schema": {
197
+
"properties": {
198
+
"status": {
199
+
"icon": "DefaultProperty",
200
+
"title": "Status",
201
+
"type": "string",
202
+
"enum": [
203
+
"SUCCESS",
204
+
"FAILURE",
205
+
"IN_PROGRESS",
206
+
"WAITING_FOR_APPROVAL",
207
+
"DECLINED"
208
+
],
209
+
"enumColors": {
210
+
"SUCCESS": "green",
211
+
"FAILURE": "red",
212
+
"IN_PROGRESS": "lightGray",
213
+
"WAITING_FOR_APPROVAL": "yellow",
214
+
"DECLINED": "red"
215
+
}
216
+
},
217
+
"created_at": {
218
+
"type": "string",
219
+
"title": "Created At",
220
+
"format": "date-time"
221
+
},
222
+
"run_id": {
223
+
"type": "string",
224
+
"title": "Run ID"
225
+
},
226
+
"run_url": {
227
+
"type": "string",
228
+
"title": "Run URL",
229
+
"format": "url"
230
+
},
231
+
"updated_at": {
232
+
"type": "string",
233
+
"title": "Updated At",
234
+
"format": "date-time"
235
+
},
236
+
"action": {
237
+
"type": "string",
238
+
"title": "Action"
239
+
}
240
+
},
241
+
"required": []
242
+
},
243
+
"mirrorProperties": {},
244
+
"calculationProperties": {},
245
+
"aggregationProperties": {},
246
+
"relations": {}
247
+
}
248
+
```
249
+
</details>
250
+
251
+
252
+
<h3>Define the automation</h3>
253
+
254
+
The following automation updates the `Action run` entity with information regarding this run.
255
+
To add it, follow these steps:
256
+
257
+
1. Go to the [Automations](https://app.getport.io/settings/automations) page of your portal.
258
+
259
+
2. Click on the `+ Automation` button.
260
+
261
+
3. Click on the `{...} Edit JSON` button in the top right corner.
262
+
263
+
4. Copy and paste the following JSON configuration into the editor, then click `Save`.
264
+
265
+
<details>
266
+
<summary><b>Update `Action run` automation definition (click to expand)</b></summary>
Copy file name to clipboardExpand all lines: docs/actions-and-automations/create-self-service-experiences/setup-the-backend/setup-the-backend.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,10 @@ For example, say we have an action with one user input that is the user's name.
57
57
}
58
58
```
59
59
60
+
:::info `.run` available values
61
+
When the action is triggered, the `.run` object includes only the run `id`.
62
+
:::
63
+
60
64
You may have noticed that the example above also sends `{{ .run.id }}`. This is a unique identifier for each execution of the action, and can be used to interact with the action run in Port from your backend.
61
65
62
66
Now you might be thinking - *how do I know what data is available to me when constructing the payload?*
Copy file name to clipboardExpand all lines: docs/actions-and-automations/define-automations/setup-action.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,11 @@ Here is an example for an automation payload:
46
46
}
47
47
```
48
48
49
-
You may have noticed that the example above also sends `{{ .run.id }}`. This is a unique identifier for each execution of the automation, and can be used to interact with the autmation run in Port from your backend.
49
+
:::info `.run` available values
50
+
When the automation is triggered, the `.run` object includes only the run `id`.
51
+
:::
52
+
53
+
You may have noticed that the example above also sends `{{ .run.id }}`. This is a unique identifier for each execution of the automation, and can be used to interact with the automation run in Port from your backend.
50
54
51
55
Now you might be thinking - *how do I know what data is available to me when constructing the payload?*
0 commit comments