repository_dispatch response

I’m wondering why the 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?


@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.


curl -i -H "Authorization: token <my_token>"<my_repo>/actions/runs?status=in_progress

correctly returns 0 jobs

however, running 

curl -i -H "Authorization: token <my_token>"<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 page doesn’t explicitly mention it and I am having no luck trying suggested methods, e.g. 

?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

If this endpoint response contained a pointer instead of 204, it would be enable a workflow to await the status of the dispatched workflow, and fail or pass the dispatching workflow. This is critical for pull request validation.

1 Like