Skip to content

[skip-changelog] Try to whitelist CI for Cloudflare spam-check filters #1796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2022
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/test-go-integration-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions configuration/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package configuration
import (
"fmt"
"net/url"
"os"
"runtime"

"github.com/arduino/arduino-cli/cli/globals"
Expand All @@ -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)
Expand Down