Create github issue from travis.yaml

126 Views Asked by At

I am looking for some ways to create a github issue from travis. I am calling some scripts in travis.yaml file and I need to create a github issue when travis is executed. I came across documents on calling github APIS using curl command.

Eg: curl -u $username -i -H "Content-Type: application/json" -X POST --data '{"title":"'$title'", "body":"'$body'"}' https://api.github.com/repos/$username/$repo_name/issues

Instead of username , since the build is triggered via travis, should I use github tokens? Is there any environment variable available which represents github token.

1

There are 1 best solutions below

0
ambikanair On BEST ANSWER

Found the answer myself. Create a github token using the github API and add that as ENV variable to your Travis CI settings.

This token can be used to perform the curl operation in travis shell script.

Helpful link : https://blogs.infosupport.com/accessing-githubs-rest-api-with-curl/