Workflow_dispatch API does not return any data

Hi,

When I use workflow_dispatch API to trigger events, there is no data returned. With repository_dispatch for eg. there is lots of useful data like commit ID that is returned that can be used elsewhere in the application.

#!/usr/bin/env python

import threading
import json
from time import sleep
import requests

github_token = "xxx"
task = "test"

github_auth_token = 'token ' + github_token

headers = {'Authorization': github_auth_token, 'Accept': 'application/vnd.github.v3+json', 'Content-Type': 'application/json'}
payload = {'ref': 'master'}
url = 'https://api.github.com/repos/yyy/zzz/actions/workflows/' + task + '.yml/dispatches'
r = requests.post(url, data=json.dumps(payload), headers=headers)
print(r.content)

Output:

b''

Expected output: JSON with useful info.

@arhue,

Currently the “Create a workflow dispatch event” endpoint only returns a status code. No content will be returned in the response. It is designed like this.
The “Create a repository dispatch event” endpoint is same as this.

If you really need that the endpoint can return some useful information in the response content, I recommend that you can directly share a feature request in the Feedback form for GitHub.
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

@brightran You’re right. repository_dispatch does not return anything, but /deployments API does. I found that to be extremely helpful. I’ve already sent feedback on that form. I’ll wait for a reply, thanks! :slight_smile: