mirror of
https://github.com/actions/toolkit.git
synced 2026-08-11 00:00:28 +02:00
Add ACTIONS_ORCHESTRATION_ID support to http-client user-agent
Co-authored-by: TingluoHuang <[email protected]>
This commit is contained in:
co-authored by
TingluoHuang
parent
09cb71a033
commit
4e1c194b34
@@ -599,7 +599,7 @@ export class HttpClient {
|
||||
info.options.method = method
|
||||
info.options.headers = this._mergeHeaders(headers)
|
||||
if (this.userAgent != null) {
|
||||
info.options.headers['user-agent'] = this.userAgent
|
||||
info.options.headers['user-agent'] = this._getUserAgentWithOrchestrationId(this.userAgent)
|
||||
}
|
||||
|
||||
info.options.agent = this._getAgent(info.parsedUrl)
|
||||
@@ -816,6 +816,14 @@ export class HttpClient {
|
||||
return proxyAgent
|
||||
}
|
||||
|
||||
private _getUserAgentWithOrchestrationId(userAgent: string): string {
|
||||
const orchId = process.env['ACTIONS_ORCHESTRATION_ID']
|
||||
if (orchId) {
|
||||
return `${userAgent} (gh_orch_id:${orchId})`
|
||||
}
|
||||
return userAgent
|
||||
}
|
||||
|
||||
private async _performExponentialBackoff(retryNumber: number): Promise<void> {
|
||||
retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber)
|
||||
const ms: number = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber)
|
||||
|
||||
Reference in New Issue
Block a user