Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js, create a github issue on a private repo

I have a private github repo that I would like to track issues for my app on. Github's API describes how to create an issue through a POST request. My question is, does this only work for public repositories? Am I overlooking a simple solution for allowing my application to create issues? I have tried the code below, however had no luck. Thanks!

var request = require('request');

var bugReport = 

{
  "title": "Found a bug",
  "body": "I'm having a problem with this.",
  "labels": [
    "bug"
  ]
}

request.post(
    'https://api.github.com/repos/...(username).../...(repo).../issues',
    { json: bugReport },
    function (error, response, body) {
        if (!error && response.statusCode == 200) {
            console.log(body)
        }
    }
);
like image 798
Ian Wise Avatar asked Mar 21 '26 05:03

Ian Wise


1 Answers

You need to use an OAuth token with the right scope to authenticate before you can post to a private repo. See https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/

like image 191
user835611 Avatar answered Mar 22 '26 19:03

user835611



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!