Ian Wise
Ian Wise

Reputation: 766

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)
        }
    }
);

Upvotes: 3

Views: 1089

Answers (1)

user835611
user835611

Reputation: 2376

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/

Upvotes: 3

Related Questions