From 0fd8eac305dbcacab02d114d5facecc82cf60c1e Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Fri, 8 Dec 2023 14:01:22 +0100 Subject: [PATCH] Update user agent for new ghalistener (#3138) --- cmd/ghalistener/config/config.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/ghalistener/config/config.go b/cmd/ghalistener/config/config.go index cc229838..127a57e7 100644 --- a/cmd/ghalistener/config/config.go +++ b/cmd/ghalistener/config/config.go @@ -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 { @@ -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 "": @@ -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 +}