Commit graph

17 commits

Author SHA1 Message Date
William Martin
3ed389d664 Disable telemetry for GHES 2026-04-17 11:50:24 +02:00
William Martin
c51769c977 Record agentic invocations in User-Agent header
Detect which AI coding agent is invoking gh by checking well-known
environment variables and include the agent name in the User-Agent
header sent to GitHub APIs.

Supported agents: Codex, Gemini CLI, Copilot CLI, OpenCode,
Claude Code, and Amp. Generic AI_AGENT env var is also supported
with validation to prevent header injection.

Fixes github/cli#1111

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 19:58:37 +01:00
William Martin
166db75d36 pin REST API version to 2022-11-28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-13 19:46:16 +01:00
Babak K. Shandiz
55fbad3e49
test(api): assert SkipDefaultHeaders is honoured
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-13 16:37:32 +01:00
Babak K. Shandiz
b9e04ef83d
test(api): improve NewHTTPClient test assertions
The assertions should check for header values instead of single string,
because when getting a single header value, we get an empty string if
the header is not set or is set to an empty string. So, to make sure a
header is not set we should check the `Values` slice which is `nil` only
if the header is missing.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-13 16:33:03 +01:00
Naoya Yasuda
5d79a95a32
Upgrade to Go 1.22 (#8836) 2024-04-02 14:34:59 +02:00
Sam Coe
024cb939af Rename authCfg.Token to authCfg.ActiveToken and authCfg.SetToken to authCfg.SetActiveToken 2023-12-06 14:06:28 +01:00
Sam Coe
ebcf3a1022
Set default Accept header for api command when one is not specified (#8303) 2023-11-06 15:22:32 +01:00
Jun Nishimura
508065b72d
Add verbose flag to api cmd (#7826) 2023-08-25 09:37:37 -07:00
Sam Coe
8079d18efd
Use asciisanitization package from go-gh (#7745) 2023-07-24 10:50:33 -07:00
Sam Coe
2a4160a3a3
Do not add auth token to redirect requests which do not have the same host as the inital request. (#7692) 2023-07-14 08:12:20 +09:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
Mislav Marohnić
4b2e380768
Normalize time-zone headers in tests
Setting a static time zone guards from test failures when the local time zone could not be detected.
2022-11-02 12:54:39 +01:00
Eng Zer Jun
471cbea4fa
test: use t.Setenv to set env vars in tests (#6333)
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-09-26 08:46:02 +00:00
Sam Coe
e5cf302ad8
Post go-gh integration cleanup (#5933) 2022-07-13 14:58:50 +02:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Sam Coe
074ed50b8a
Integrate go-gh API package (#5614) 2022-06-23 04:05:31 +01:00
Renamed from pkg/cmd/factory/http_test.go (Browse further)