GitHub Action: Provide webhook callback URL custom and wait for completion - github

I am looking for a method to generate a custom webhook callback URL unique to each build within my github action. The purpose of this is that I have a github action which simply starts a test on a server (i.e. browserstack)and returns. It has the option to provide a webhook to call upon test completion.
I ideally would want to somehow generate a webhook custom to this build, and then trigger another action which waits for the webhook callback before continuing. I can always have a polling mechanism which runs every 60 seconds, but I personally prefer to avoid this.

Related

Trigger deployment_status from within another Github action

I have one action that sets the deployment status to success which in turn should trigger another action but that does not seem to work. Isn’t it possible to listen for deployment_status changes in one action that are triggered from within another action?
By design, an action in a workflow run can’t trigger a new workflow run with the default GitHub token. Please refer to the official doc for more details.
Creating personal access token as secrets instead is the workaround.

Is it possible to make two webhook calls at the same time?

I'd like to know if I can make 2 webhook calls at the same time.
I have two cloud functions: 1) Inserting a user 2) Capture user inputs
How can I go about that using webhooks on watson assistant?
(I've already posted this question on the IBM developer forum but didn't get an answer.https://developer.ibm.com/answers/questions/520504/is-it-possible-to-make-two-webhook-calls-at-the-sa.html)
Right now, there is only a form to add a single webhook to the dialog node. The reason is that each call returns values which then need to be processed by the node. Thus, you cannot make them in parallel.
If you want to make two calls for the same input data, you could do one of:
make a master webhook that then calls the other webhooks
define a sequence of actions to be processed and which is called from Watson Assistant
first call one webhook, then have a dependent node which is processed without user input, from that node perform the second webhook call
There are probably even more options, it depends on the call semantics and whether your webhooks are dependent on results / inputs or not.
One of my code samples uses a dispatch semantic to call other functions. It can be done within the same action as shown for simplicity, calling into other functions (using composer) or using REST calls into other webhooks.

DialogFlow Fulfilment connecting to REST APIs

I want to use Dialogflow fulfillment to connect to an external webservice / API. One way of doing that is to use the custom webhook feature (not the inline web hook). However, when using the custom web hook it seems that you are limited to creating just one even though you may have many intents and you may want to call many endpoints. Is there a way to link to more custom webhooks (API endpoints)?
If you can only set up one web hook then your webserivce will always receive a Post request from Dialogflow and will then need to interpret the body of the request i.e. based on the intent parameter. Just wondering is there a better way to work with REST webservices with Dialogflow.
The other potential option is to use the inline web hook and then put logic in there to call specific endpoints, however, that might get a bit messy.
You can only setup one fulfillment that will handle the processing for all the Intents you've enabled. This can be either the built-in one through the fulfillment editor or at a webhook URL you specify.
That webhook is expected to delegate the actual processing to an Intent Handler of some sort. The Dialogflow node.js fulfillment library has a way to register what handler you want for each Intent name, or you can switch on the Intent name, the Action name, or any other field provided to you in your code.
In the library, you'll typically make the REST calls from an appropriate Intent handler which will take the parameters provided and craft the call. If you are using Javascript, make sure you are handling the call asynchronously and return a Promise.
I recommend a webhook because it gives you more control than the inline editor does. The inline editor is really just a webhook under the covers using Firebase Cloud Functions. Even putting it yourself in a Cloud Function gives you better control over it.
There may be costs depending where you host it, however Firebase has a free tier that is sufficient for testing and light operation. Once your Action is published, you are also eligible for a monthly cloud credit from Google.

What's the OpenWhisk way to keep an auth token alive?

So, I am dealing with a system where I need to be keeping an auth token alive by periodically (essentially daily) renewing the token and giving it to the functions that need it.
The way I would do this in plain old node.js is I would just use a SetInterval timer to renew it.
should I approach this the same way with an OpenWhisk action? I can build into the action it's work SetInterval and keep the token up to date. Or I could imagine creating an action which took input from an interval trigger as well as regular requests and have the action update on trigger requests and return the token on other requests. Or should I be using cloudant as the backend to manage the token?
Thoughts?
The following approach might solve your issue
write one action (A) that renews the token
call action A at the beginning of any other action by using the action sequence capability Creating action sequences
use the alarms (cron) trigger service to run action A periodically in order to renew the token even if your sequence is not executed Using the Alarms package
in case you need to store the token in action A you might think about using cloudant

Github Pull Request Checks

Is it possible to create a Github Check for pull requests? I know there are WebHooks, but is there a way to also hook into the UI?
Aim:
Pull Request made. Perform validation and update pull request if valid.
Pull Request merged. Create web call to URL. Update Github issue with confirmation.
What's the best way to do this? Is it only via Web Hooks, API calls and getting write oAuth credentials?
Note: you now (August 2018) officially have the notion of Checks
When checks are set up in a repository, pull requests have a Checks tab where you can view detailed build output from status checks and rerun failed checks.
I know there are WebHooks, but is there a way to also hook into the UI?
The recommended way of doing this is to use required status checks and the Status API, in combination with webhooks:
https://help.github.com/articles/about-required-status-checks/
https://developer.github.com/v3/repos/statuses/
Users set up required status checks on the repository so that merging a pull request is blocked if a specific status isn't success.
At the same time, webhooks trigger an external process when a pull request is updated, and that process creates statuses based on the output of that process. If the process completes successfully, then the process should create a success status which will be shown in the UI and unblock the merging of the pull request.
Is it only via Web Hooks, API calls and getting write oAuth credentials?
In order to create statuses, you will indeed need to authenticate with the credentials of a user that has push access to the repository (e.g. via a token from that user with the right scopes).