Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"id": "prchecker",
"name": "Github PR Checker Workflow",
"version": "1.0",
"functions": [
{
"name": "AddLabels",
"type": "service",
"metadata": {
"interface": "org.kogito.examples.sw.github.workflow.GithubService",
"operation": "addLabels"
}
},
{
"name": "AddReviewers",
"type": "service",
"metadata": {
"interface": "org.kogito.examples.sw.github.workflow.GithubService",
"operation": "addReviewers"
}
},
{
"name": "FetchPRFiles",
"type": "service",
"metadata": {
"interface": "org.kogito.examples.sw.github.workflow.GithubService",
"operation": "fetchPRFiles"
}
}
],
"events": [
{
"name": "PROpened",
"source": "github",
"type": "cloudevent"
},
{
"name": "ChangedPR",
"source": "github",
"type": "cloudevent"
},
{
"name": "BackendNewChange",
"source": "/checker/workflow",
"type": "cloudevent"
},
{
"name": "FrontendNewChange",
"source": "/checker/workflow",
"type": "cloudevent"
},
{
"name": "PRChecked",
"source": "/checker/workflow",
"type": "cloudevent"
}
],
"states": [
{
"name": "HandleOpenPR",
"type": "event",
"start": {
"kind": "default"
},
"eventsActions": [
{
"eventRefs": [
"PROpened",
"ChangedPR"
],
"actions": [
{
"functionRef": {
"refName": "AddLabels"
}
},
{
"functionRef": {
"refName": "AddReviewers"
}
},
{
"functionRef": {
"refName": "FetchPRFiles"
}
}
]
}
],
"transition": {
"nextState": "CheckProjectChange"
}
},
{
"name": "CheckProjectChange",
"type": "switch",
"dataConditions": [
{
"path": "$.files",
"operator": "equals",
"value": "backend",
"transition": {
"produceEvent": [
{"eventRef": "BackendNewChange"},
{"eventRef": "PRChecked"}
],
// end
}
},
{
"path": "$.files",
"operator": "equals",
"value": "frontend",
"transition": {
"produceEvent": [
{"eventRef": "FrontendNewChange"},
{"eventRef": "PRChecked"}
],
// end
}
},
{
"path": "$.files",
"operator": "equals",
"value": "backendandfrontend",
"transition": {
"produceEvent": [
{"eventRef": "BackendNewChange"},
{"eventRef": "FrontendNewChange"},
{"eventRef": "PRChecked"}
],
// end
}
}
],
"default": {
// end
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment