mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
feat(plan): add plan command to create build plans
This commit is contained in:
24
pkg/gh/gh.go
Normal file
24
pkg/gh/gh.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package gh
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/google/go-github/v35/github"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
func New(ctx context.Context, token string) *github.Client {
|
||||
if token == "" {
|
||||
token = os.Getenv("GITHUB_TOKEN")
|
||||
}
|
||||
|
||||
if token == "" {
|
||||
return github.NewClient(nil)
|
||||
}
|
||||
|
||||
ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
|
||||
tc := oauth2.NewClient(ctx, ts)
|
||||
|
||||
return github.NewClient(tc)
|
||||
}
|
||||
Reference in New Issue
Block a user