Adds simple integration with github library and test with publish github
This commit is contained in:
parent
d5815e4e6a
commit
fdaf72aac4
206 changed files with 63806 additions and 2 deletions
25
github/github.go
Normal file
25
github/github.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
"github.com/google/go-github/v29/github"
|
||||
)
|
||||
|
||||
type GithubClient struct {
|
||||
*github.Client
|
||||
Repo string
|
||||
}
|
||||
|
||||
func NewClient(repo, token string) *GithubClient {
|
||||
ctx := context.Background()
|
||||
ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
|
||||
tc := oauth2.NewClient(ctx, ts)
|
||||
|
||||
client := github.NewClient(tc)
|
||||
return &GithubClient{
|
||||
Client: client,
|
||||
Repo: repo,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue