repository_dispatch response

I’m wondering why the https://developer.github.com/v3/repos/#create-a-repository-dispatch-event response is 204: no-content, could it not return a pointer to the job that is created? It doesn’t seem as HATEOS as the rest of teh endpoints

I’m trying to build a bot that triggers a long running test suite via action, currently I have to poll <repo>/actions/workflows/manual-integration-tests.yml/runs?status=in_progress until a job exists, get the run_url and then poll that until the status changes.

Is there a better method of finding the job I triggered? Or am I fundamentally missing the point of repository_dispatch events?

2 Likes

@colinbruce ,

This API indeed does not fetch response context and returns the status code. It just trigger the  repository_dispatch event on the specified repository, and pass the data you set in client_payload to the workflow runs via the repository_dispatch event.

Currently, we have no easy ways to fetch more response context from this API. As a workaround, maybe you can try using the API List repository workflow runs to list all the workflow runs in the specified repository after executing the API to create a repository dispatch event.

When using this PAI to list workflow runs, you can use parameters to narrow the list of results. In your case, you can try set the below parameters.

event: repository_dispatch

status: queued, in_progress

Of course, if your projects really need this feature, you can directly report a feature request here. That will allow you to directly interact with the appropriate engineering team, and make it more convenient for the engineering team to collect and categorize your suggestions.

1 Like

I’m querying the workflow/runs endpoint at the moment but I just wanted to make sure there wasn’t a better method that I’d missed!

Thanks for the quick response.

I was interested by the point you raised about multiple parameters

status: queued, in_progress

This was indeed something I had issues with, being the UK, starting a job now almost immediately triggers and goes straight to in  in_progress but later in the day may be  queued.

Running 

curl -i -H "Authorization: token <my_token>" https://api.github.com/repos/colinbruce/<my_repo>/actions/runs?status=in_progress

correctly returns 0 jobs

however, running 

curl -i -H "Authorization: token <my_token>" https://api.github.com/repos/colinbruce/<my_repo>/actions/runs?status=in_progress,queued

returns all jobs on the repo.  

Is there a correct method of passing multiple  or parameters, the https://developer.github.com/v3/#parameters page doesn’t explicitly mention it and I am having no luck trying suggested methods, e.g. 

?status=in_progress&status=queued
or
?status=in_progress,queued
or
?status=in_progress, queued
1 Like

@colinbruce ,

Ideally, the " status=in_progress,queued" should work, but it does not. I also tried " status=in_progress;queued" and other syntax you mentioned, however all of these do not work as expected.
I viewed many related descriptions about " query parameters" on Internet, but all of them are only use one value of a query parameter, the symbol ’ &’ seems is used to separate multiple different query parameters.

Looks like, it seems does not support to set multiple values for a query parameter. And we seem need to set the multiple values a an array, and then call this array in a loop to execute the endpoint. Although this may sound cumbersome, it may be the only available way.

1 Like