diff --git a/.github/workflows/test-go-integration-task.yml b/.github/workflows/test-go-integration-task.yml index f9de83c5b74..aea78ced81c 100644 --- a/.github/workflows/test-go-integration-task.yml +++ b/.github/workflows/test-go-integration-task.yml @@ -84,6 +84,9 @@ jobs: runs-on: ${{ matrix.operating-system }} + env: + ARDUINO_CLI_USER_AGENT_EXTENSION: ${{ secrets.CLOUDFLARE_SPAMCHECK_BYPASS_TOKEN }} + steps: # By default, actions/checkout converts the repo's LF line endings to CRLF on the Windows runner. - name: Disable EOL conversions diff --git a/configuration/network.go b/configuration/network.go index 04d6bb98985..e2e81d937bb 100644 --- a/configuration/network.go +++ b/configuration/network.go @@ -18,6 +18,7 @@ package configuration import ( "fmt" "net/url" + "os" "runtime" "github.com/arduino/arduino-cli/cli/globals" @@ -34,12 +35,18 @@ func UserAgent(settings *viper.Viper) string { subComponent = " " + subComponent } - return fmt.Sprintf("%s/%s%s (%s; %s; %s) Commit:%s", + extendedUA := os.Getenv("ARDUINO_CLI_USER_AGENT_EXTENSION") + if extendedUA != "" { + extendedUA = " " + extendedUA + } + + return fmt.Sprintf("%s/%s%s (%s; %s; %s) Commit:%s%s", globals.VersionInfo.Application, globals.VersionInfo.VersionString, subComponent, runtime.GOARCH, runtime.GOOS, runtime.Version(), - globals.VersionInfo.Commit) + globals.VersionInfo.Commit, + extendedUA) } // NetworkProxy returns the proxy configuration (mainly used by HTTP clients)