|
19 | 19 | - name: Send CDEvent |
20 | 20 | uses: cdviz-dev/send-cdevents@v1 |
21 | 21 | with: |
22 | | - data: '{"type": "dev.cdevents.build.started.0.1.1", "source": "github-action"}' |
| 22 | + data: | |
| 23 | + { |
| 24 | + "context": { |
| 25 | + "version": "0.4.1", |
| 26 | + "source": "github-actions", |
| 27 | + "type": "dev.cdevents.taskrun.started.0.2.0" |
| 28 | + }, |
| 29 | + "subject": { |
| 30 | + "id": "${{ github.run_id }}", |
| 31 | + "type": "taskRun", |
| 32 | + "content": { |
| 33 | + "taskName": "ci-build" |
| 34 | + } |
| 35 | + } |
| 36 | + } |
23 | 37 | url: "https://your-webhook-endpoint.com/cdevents" |
24 | 38 | ``` |
25 | 39 |
|
|
38 | 52 | - name: Send CDEvent |
39 | 53 | uses: cdviz-dev/send-cdevents@v1 |
40 | 54 | with: |
41 | | - data: '{"type": "dev.cdevents.build.started.0.1.1", "source": "github-action"}' |
| 55 | + data: | |
| 56 | + { |
| 57 | + "context": { |
| 58 | + "version": "0.4.1", |
| 59 | + "source": "github-actions", |
| 60 | + "type": "dev.cdevents.service.deployed.0.2.0" |
| 61 | + }, |
| 62 | + "subject": { |
| 63 | + "id": "${{ github.repository }}", |
| 64 | + "type": "service", |
| 65 | + "content": { |
| 66 | + "environment": { |
| 67 | + "id": "production" |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | + } |
42 | 72 | url: "https://your-webhook-endpoint.com/cdevents" |
43 | 73 | headers: | |
44 | 74 | Authorization: Bearer ${{ secrets.API_TOKEN }} |
|
60 | 90 | - name: Send CDEvent with HMAC signature |
61 | 91 | uses: cdviz-dev/send-cdevents@v1 |
62 | 92 | with: |
63 | | - data: '{"type": "dev.cdevents.build.started.0.1.1", "source": "github-action"}' |
| 93 | + data: | |
| 94 | + { |
| 95 | + "context": { |
| 96 | + "version": "0.4.1", |
| 97 | + "source": "github-actions", |
| 98 | + "type": "dev.cdevents.testcaserun.started.0.2.0" |
| 99 | + }, |
| 100 | + "subject": { |
| 101 | + "id": "${{ github.run_id }}-test", |
| 102 | + "type": "testCaseRun", |
| 103 | + "content": { |
| 104 | + "testCase": { |
| 105 | + "name": "Integration Tests", |
| 106 | + "type": "integration" |
| 107 | + } |
| 108 | + } |
| 109 | + } |
| 110 | + } |
64 | 111 | url: "https://your-webhook-endpoint.com/cdevents" |
65 | 112 | config: | |
66 | 113 | [sinks.http.headers.x-signature-256] |
@@ -150,9 +197,45 @@ Examples: |
150 | 197 |
|
151 | 198 | ```yaml |
152 | 199 | with: |
153 | | - data: '{"type": "dev.cdevents.build.started.0.1.1", "source": "github-action"}' |
| 200 | + data: | |
| 201 | + { |
| 202 | + "context": { |
| 203 | + "version": "0.4.1", |
| 204 | + "source": "github-actions", |
| 205 | + "type": "dev.cdevents.taskrun.started.0.2.0" |
| 206 | + }, |
| 207 | + "subject": { |
| 208 | + "id": "${{ github.run_id }}", |
| 209 | + "type": "taskRun", |
| 210 | + "content": { |
| 211 | + "taskName": "ci-build" |
| 212 | + } |
| 213 | + } |
| 214 | + } |
154 | 215 | ``` |
155 | 216 |
|
| 217 | +> [!TIP] |
| 218 | +> The `context.id` and `context.timestamp` fields can be automatically generated by cdviz-collector if missing from your CDEvent. You can provide minimal CDEvents and let the collector handle the required metadata: |
| 219 | +> |
| 220 | +> ```yaml |
| 221 | +> with: |
| 222 | +> data: | |
| 223 | +> { |
| 224 | +> "context": { |
| 225 | +> "version": "0.4.1", |
| 226 | +> "source": "github-actions", |
| 227 | +> "type": "dev.cdevents.taskrun.started.0.2.0" |
| 228 | +> }, |
| 229 | +> "subject": { |
| 230 | +> "id": "${{ github.run_id }}", |
| 231 | +> "type": "taskRun", |
| 232 | +> "content": { |
| 233 | +> "taskName": "ci-build" |
| 234 | +> } |
| 235 | +> } |
| 236 | +> } |
| 237 | +> ``` |
| 238 | + |
156 | 239 | ### From File |
157 | 240 |
|
158 | 241 | ```yaml |
|
0 commit comments