I am trying to initiate a GitHub action workflow using python.
in my GitHub repository I have a yml file that will start with a manually trigger:
on:
repository_dispatch:
types: [build]
I have created a token in github>settings>developer settings>personal access tokens. In order to keep it secret, we will suppose that the token number is: '123' in this question.
I want to start the workflow in a python script with the request library, so I have write the following code:
token = '1234'
headers = {'Authorization' : 'token ' + token }
data = {"event_type": "build"}
r = requests.post("http://api.github.com/repos/myorganizationname/repositoryname/dispatches", headers = headers,data= data)
I am getting the following status_code:
r.status_code
404
I am not sure if I am writing the Authorization in the correct place or what I am writing wrong, could someone help me here?