Skip to content

Commit e49fb06

Browse files
npm run prepare
1 parent 0c4469a commit e49fb06

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

dist/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ class HttpClient {
16551655
this._maxRetries = 1;
16561656
this._keepAlive = false;
16571657
this._disposed = false;
1658-
this.userAgent = userAgent;
1658+
this.userAgent = this._getUserAgentWithOrchestrationId(userAgent);
16591659
this.handlers = handlers || [];
16601660
this.requestOptions = requestOptions;
16611661
if (requestOptions) {
@@ -2135,6 +2135,17 @@ class HttpClient {
21352135
}
21362136
return proxyAgent;
21372137
}
2138+
_getUserAgentWithOrchestrationId(userAgent) {
2139+
const baseUserAgent = userAgent || 'actions/http-client';
2140+
const orchId = process.env['ACTIONS_ORCHESTRATION_ID'];
2141+
if (orchId) {
2142+
// Sanitize the orchestration ID to ensure it contains only valid characters
2143+
// Valid characters: 0-9, a-z, _, -, .
2144+
const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_');
2145+
return `${baseUserAgent} actions_orchestration_id/${sanitizedId}`;
2146+
}
2147+
return baseUserAgent;
2148+
}
21382149
_performExponentialBackoff(retryNumber) {
21392150
return __awaiter(this, void 0, void 0, function* () {
21402151
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)