diff options
| author | Copilot <198982749+Copilot@users.noreply.github.com> | 2026-01-08 15:07:38 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-08 15:07:38 -0500 |
| commit | 72bc64336da5b556e438a70b19caa4f80eebee98 (patch) | |
| tree | d50b5efdee9020a20002cc148c22de377f93c60e /dist/index.js | |
| parent | 030adaf98b69f496593a6a141dcc92333b657b77 (diff) | |
Add orchestration_id to git user-agent when ACTIONS_ORCHESTRATION_ID is set (#2355)
* Initial plan
* Add orchestration ID support to git user-agent
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Improve tests to verify user-agent content and handle empty sanitized IDs
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
* Simplify orchestration ID validation to accept any non-empty sanitized value
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
* Remove test for orchestration ID with only invalid characters
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
Co-authored-by: Tingluo Huang <tingluohuang@github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Diffstat (limited to 'dist/index.js')
| -rw-r--r-- | dist/index.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/dist/index.js b/dist/index.js index b9b34d3..4eab86e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1206,7 +1206,17 @@ class GitCommandManager { } } // Set the user agent - const gitHttpUserAgent = `git/${this.gitVersion} (github-actions-checkout)`; + let gitHttpUserAgent = `git/${this.gitVersion} (github-actions-checkout)`; + // Append orchestration ID if set + const orchId = process.env['ACTIONS_ORCHESTRATION_ID']; + if (orchId) { + // Sanitize the orchestration ID to ensure it contains only valid characters + // Valid characters: 0-9, a-z, _, -, . + const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_'); + if (sanitizedId) { + gitHttpUserAgent = `${gitHttpUserAgent} actions_orchestration_id/${sanitizedId}`; + } + } core.debug(`Set git useragent to: ${gitHttpUserAgent}`); this.gitEnv['GIT_HTTP_USER_AGENT'] = gitHttpUserAgent; }); |
