Skip to content

Instantly share code, notes, and snippets.

@tsurdilo
Created August 28, 2020 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsurdilo/96a925ad7f9e320dfaa365edbe3ff88c to your computer and use it in GitHub Desktop.
Save tsurdilo/96a925ad7f9e320dfaa365edbe3ff88c to your computer and use it in GitHub Desktop.
{
"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