Skip to content

Commit

Permalink
Update user agent for new ghalistener (#3138)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-jokic authored Dec 8, 2023
1 parent b78cadd commit 0fd8eac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/ghalistener/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/actions/actions-runner-controller/github/actions"
"github.com/actions/actions-runner-controller/logging"
"github.com/go-logr/logr"
"golang.org/x/net/http/httpproxy"
)

type Config struct {
Expand Down Expand Up @@ -101,7 +102,6 @@ func (c *Config) Logger() (logr.Logger, error) {
}

func (c *Config) ActionsClient(logger logr.Logger) (*actions.Client, error) {

var creds actions.ActionsAuth
switch c.Token {
case "":
Expand Down Expand Up @@ -141,7 +141,14 @@ func (c *Config) ActionsClient(logger logr.Logger) (*actions.Client, error) {
Version: build.Version,
CommitSHA: build.CommitSHA,
ScaleSetID: c.RunnerScaleSetId,
HasProxy: hasProxy(),
Subsystem: "ghalistener",
})

return client, nil
}

func hasProxy() bool {
proxyFunc := httpproxy.FromEnvironment().ProxyFunc()
return proxyFunc != nil
}

0 comments on commit 0fd8eac

Please sign in to comment.