Cannot create issue

7 views
Skip to first unread message

Andreas Goetz

unread,
Jun 9, 2021, 12:46:59 PM6/9/21
to go-github
Hi,

I'm really stumped as to why this does not work:

    ts := oauth2.StaticTokenSource(&oauth2.Token{
AccessToken: "...",
})

client := github.NewClient(oauth2.NewClient(context.Background(), ts))

title := "Test"
ir := github.IssueRequest{
Title: &title,
Body: &title,
}

issue, _, err := client.Issues.Create(context.Background(), "andig", "evcc", &ir)
if err != nil {
log.Fatal(err)
}

Always ends in HTTP 404- any idea why that might be?

Glenn Lewis

unread,
Jun 9, 2021, 2:31:06 PM6/9/21
to go-github
When you created your Personal Access Token (here: https://github.com/settings/tokens ),
did you give it the full repo scope so that it has permission to create issues?
-- Glenn

Andreas Goetz

unread,
Jun 10, 2021, 2:21:11 AM6/10/21
to go-github
Ah, I didn't as I let myself be tricked by the Github UI:

Screenshot 2021-06-10 at 08.19.52.png

it seemed to me as if the "repo" settings only applied to private repos. Adding public_repo fixed the issue.

Thanks!

Reply all
Reply to author
Forward
0 new messages