fix: prevent duplicate orchestration ID in user-agent
Add idempotency check to getUserAgentWithOrchestrationId — if the tag is already present in baseUserAgent, return it unchanged. This prevents doubling when both the exported helper and getOctokitOptions run for the same client.
This commit is contained in:
@@ -49,8 +49,10 @@ export function getUserAgentWithOrchestrationId(
|
||||
const orchId = process.env['ACTIONS_ORCHESTRATION_ID']?.trim()
|
||||
if (orchId) {
|
||||
const sanitizedId = orchId.replace(/[^a-z0-9_.-]/gi, '_')
|
||||
const tag = `actions_orchestration_id/${sanitizedId}`
|
||||
if (baseUserAgent?.includes(tag)) return baseUserAgent
|
||||
const ua = baseUserAgent ? `${baseUserAgent} ` : ''
|
||||
return `${ua}actions_orchestration_id/${sanitizedId}`
|
||||
return `${ua}${tag}`
|
||||
}
|
||||
return baseUserAgent
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user