Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
![logo](docs/assets/logo.png)

[![actions-workflow-test][actions-workflow-test-badge]][actions-workflow-test]
[![actions-marketplace][actions-marketplace-badge]][actions-marketplace]
[![release][release-badge]][release]
[![pkg.go.dev][pkg.go.dev-badge]][pkg.go.dev]
[![dependabot][dependabot-badge]][dependabot]
[![license][license-badge]][license]
## Heads up
⚠️ ‼️ I'm archiving this fork, as GHES and GHAE customers should use https://github.com/github/safe-settings#the-settings-file for this instead

GitHub Actions workflow to sync GitHub labels in the declarative way.

Expand Down
5 changes: 4 additions & 1 deletion cmd/action-label-syncer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ func run(ctx context.Context) error {
if len(token) == 0 {
token = os.Getenv("GITHUB_TOKEN")
}
client := github.NewClient(token)

rawurl := os.Getenv("GITHUB_API_URL")

client := github.NewClient(token, rawurl)

repository := os.Getenv("INPUT_REPOSITORY")
if len(repository) == 0 {
Expand Down
8 changes: 6 additions & 2 deletions pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ func FromManifestToLabels(path string) ([]Label, error) {
return labels, err
}

func NewClient(token string) *Client {
func NewClient(token string, rawurl string) *Client {
ctx := context.Background()
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: token},
)
tc := oauth2.NewClient(ctx, ts)
githubClient, err := github.NewEnterpriseClient(rawurl, rawurl, tc)
if err != nil {
panic(err)
}
return &Client{
githubClient: github.NewClient(tc),
githubClient: githubClient,
}
}

Expand Down