Go-Github is a Go library implementing the GitHub API, to manage GitHub resources (repositories, user profiles, organizations, etc.) from Go Lang scripts.
Questions tagged [go-github]
18 questions
3
votes
1 answer
Failing to create a commit using go-github with 422 - Update is not a fast forward
I am using the following function to simply create a new commit in a branch using go-github library
func GHAPICreateCommit(ctx context.Context, client *github.Client, commitOpts *CommitOptions) error {
// Get the reference of the branch
ref,…

pkaramol
- 16,451
- 43
- 149
- 324
3
votes
1 answer
Unable to download Go packages from GitHub
I'm getting below error while downloading.
go get github.com/go-sql-driver/mysql: module github.com/go-sql-driver/mysql: Get "https://proxy.golang.org/github.com/go-sql-driver/mysql/@v/list": x509: certificate signed by unknown authority
Go version…

alok rai
- 31
- 4
2
votes
1 answer
Go-github not retrieving tag names correctly
I have the following simple golang code which retrieves tags from terraform repository:
import (
"github.com/google/go-github/v48/github"
"context"
)
func main() {
client := github.NewClient(nil)
tags, _, _ :=…

gopherhidden
- 21
- 2
2
votes
1 answer
how do we know the user changed profile picture from default in github via api
I'm working on a script to audit Github. so in that process im trying to find a way to know if the GitHub user in my organization has changed their profile picture from the default profile picture.
Im working with the go-github package to access…

DonOfDen
- 3,968
- 11
- 62
- 112
1
vote
1 answer
How to perform a force push using Github API V3 from one repository to another?
I'm working on a service that uses github. For a function, I need to force push everything from Repo 1 to Repo 2.
*Don't care about any of the content, trees, commit history, etc of Repo 2. It is to be replaced.
End goal is that Repo 2 ends up…

Jacob Wartofsky
- 11
- 1
1
vote
1 answer
How to use go-github to post a comment on a Github issue?
I want to use https://github.com/google/go-github for creating a comment on an issue, but this test code fails:
package main
import (
"golang.org/x/oauth2"
"github.com/google/go-github/v49/github"
)
func main() {
ctx :=…

githubgo
- 23
- 2
1
vote
0 answers
List pull request comments using go-github
I am trying to retrieve list of comments for particular Pull Request using go-github.
I am interested in comments listed in the section Conversation not the review comments.
I tried to use PullRequests.ListComments, but it returns review…

Michal Škultéty
- 200
- 3
- 20
1
vote
0 answers
go-git timing out creating tree
I'm doing a similar implementation of this example https://github.com/google/go-github/blob/03b5525554d33bcc1a735ab509224599107227a9/example/commitpr/main.go
I'm running into this error
POST https://api.github.com/repos/XXX/XXX/git/trees: 502 Sorry,…

Rafael Simões
- 347
- 1
- 4
- 12
1
vote
1 answer
Is there a way to use go-github client to get all or some of the remote branches that contains a git sha?
Writing a go GitHub client that can get branch names based on a git sha.

shakalaka
- 151
- 1
- 7
0
votes
1 answer
Tree SHA is not a tree object error in go-github library
I am trying to create an empty commit in GitHub using go-github.
The following code:
func createHeadBranchForPR(ctx context.Context, baseBranch, repo, owner string,
client *github.Client) (newBranch string, err error) {
newBranch =…

pkaramol
- 16,451
- 43
- 149
- 324
0
votes
0 answers
I am facing this issue while using the go-get package, dk how to fix it
The error message :
cannot use (func(c *object.Commit) error literal) (value of type func(c *"github.com/go-git/go-git/plumbing/object".Commit) error) as func(*"github.com/go-git/go-git/v5/plumbing/object".Commit) error value in argument to…

Amit goyal
- 9
- 1
0
votes
1 answer
Use Search API for Pull Requests with go-github
Scenario: I receive a status webhook event from GitHub. I want to find any Pull Requests associated with the commit.
The StatusEvent contains the commit .SHA and a .Repo (Respository) object. This appears to be sufficient to find applicable…

EthanB
- 4,239
- 1
- 28
- 46
0
votes
1 answer
is there a way to verify if a git sha belongs to a git branch with go-github client?
would like to use go GitHub client to get result like
git branch -r origin/ --contains

shakalaka
- 151
- 1
- 7
0
votes
1 answer
Github REST API ... go-github seems to lack features in PyGithub?
I have a working script that accesses the Github REST API (v3) to (a) submit a search query and get results, and then (b) iterate through search results to download individual source code files for more processing.
The original script uses Python +…

David Jones
- 2,139
- 2
- 19
- 20
0
votes
1 answer
Get GitHub repository's organization
I'm trying to list a user's repos and get the organizations they belong to using go-github.
These repositories belong to an organization, but the organization values seem to be nil.
Code:
import "github.com/google/go-github/v37/github"
func…

dbzuk
- 235
- 2
- 9