Created
August 28, 2020 21:51
-
-
Save tsurdilo/96a925ad7f9e320dfaa365edbe3ff88c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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