* Gets the user agent string with orchestration ID appended if available * @param userAgent The base user agent string * @returns The user agent string with orchestration ID appended if ACTIONS_ORCHESTRATION_ID is set
(userAgent: string)
| 118 | * @returns The user agent string with orchestration ID appended if ACTIONS_ORCHESTRATION_ID is set |
| 119 | */ |
| 120 | function getUserAgentWithOrchestrationId(userAgent: string): string { |
| 121 | const orchestrationId = process.env['ACTIONS_ORCHESTRATION_ID'] |
| 122 | if (!orchestrationId) { |
| 123 | return userAgent |
| 124 | } |
| 125 | |
| 126 | // Sanitize orchestration ID - replace invalid characters with underscore |
| 127 | const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '_') |
| 128 | |
| 129 | return `${userAgent} actions_orchestration_id/${sanitized}` |
| 130 | } |