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:
Salman Chishti authored and GitHub committed 2026-04-08 16:49:32 +00:00
1 parent 3edb5c03a4
commit 0b265950d7
2 files changed
+21 -1

No files matched your search

+3 -1
View File
@@ -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
}