Created
February 22, 2021 09:13
-
-
Save NipunaMarcus/8bed56a1409282110474152388cb27c2 to your computer and use it in GitHub Desktop.
GitHub trigger
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
import ballerina/config; | |
import ballerina/http; | |
import ballerina/oauth2; | |
import ballerina/websub; | |
import ballerinax/github.webhook as webhook; | |
oauth2:OutboundOAuth2Provider githubOAuth2Provider = new ({ | |
accessToken: config:getAsString("ACCESS_TOKEN_8E422A19_433C_11EB_8E5C_72315290F677") | |
}); | |
http:BearerAuthHandler githubOAuth2Handler = new (githubOAuth2Provider); | |
listener webhook:Listener githubWebhookListener = new (8090); | |
@websub:SubscriberServiceConfig { | |
subscribeOnStartUp: true, | |
target: [webhook:HUB, "https://github.com/NipunaMarcus/ballerina/events/*.json"], | |
hubClientConfig: { | |
auth: { | |
authHandler: githubOAuth2Handler | |
} | |
}, | |
callback: config:getAsString("CHOREO_APP_INVOCATION_URL") | |
} | |
service websub:SubscriberService / on githubWebhookListener { | |
remote function onIssuesAssigned(websub:Notification notification, webhook:IssuesEvent event) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment