Commit graph

19 commits

Author SHA1 Message Date
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
b81c2495d2
fix(api): expose SkipDefaultHeaders option
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-10-13 16:37:04 +01:00
zhuhaicity
13211af256 chore: fix some function names in comment
Signed-off-by: zhuhaicity <zhuhai@52it.net>
2025-01-12 15:07:04 +08:00
Tyler McGoffin
81591a09b8 Use go-gh/auth package for IsEnterprise, IsTenancy, and NormalizeHostname 2024-10-15 11:56:43 -07: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
dbc2f05124
Update go-gh to v2 (#7299)
* Update go-gh

* Update code for go-gh v2
2023-04-16 15:34:23 +10:00
Sam Coe
c9a2d85793
Cleanup config.AuthToken and config.DefaultHost methods (#7049) 2023-02-28 00:24:45 +00:00
Sam Coe
ced071feae
Sanitize ANSII control characters returned from the server (#6916) 2023-02-01 21:19:30 +00:00
Mislav Marohnić
d21d388b8d
Restore old GH_DEBUG=1 behavior for HTTP logging (#6054)
- No HTTP bodies or headers are logged until `GH_DEBUG=api` is used.
- Logging to terminal now supports colorization.
2022-08-10 17:59:13 +02:00
Mislav Marohnić
c22a85e2b5 Remove accidental caching from repo list and other commands
Any gh command that has invoked NewCachedHTTPClient has also
inadvertently enabled caching for the original `http.Client` due to the
nature that NewCachedHTTPClient mutates the original argument passed.
2022-07-14 19:10:32 +02:00
Sam Coe
9d70d62520
Set blank headers so they are not automatically resolved by go-gh (#5935) 2022-07-14 14:13:34 +02: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