From f80dad6b51802013cabd11375d6043da2278a627 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:27:04 +0000 Subject: [PATCH] Add underscore to valid orchestration ID characters Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> --- __test__/orchestration-id.test.ts | 14 +++++++------- dist/index.js | 4 ++-- src/main.ts | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/__test__/orchestration-id.test.ts b/__test__/orchestration-id.test.ts index c904c1d..5105c7f 100644 --- a/__test__/orchestration-id.test.ts +++ b/__test__/orchestration-id.test.ts @@ -21,7 +21,7 @@ describe('getUserAgentWithOrchestrationId', () => { process.env['ACTIONS_ORCHESTRATION_ID'] = orchestrationId // Simulate the logic from getUserAgentWithOrchestrationId - const sanitized = orchestrationId.replace(/[^a-zA-Z0-9.-]/g, '') + const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '') const result = `${baseUserAgent} orchestration-id/${sanitized}` expect(result).toBe( @@ -34,7 +34,7 @@ describe('getUserAgentWithOrchestrationId', () => { const orchestrationId = 'test@orchestration#123!abc$xyz' // Simulate the logic from getUserAgentWithOrchestrationId - const sanitized = orchestrationId.replace(/[^a-zA-Z0-9.-]/g, '') + const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '') const result = `${baseUserAgent} orchestration-id/${sanitized}` expect(result).toBe( @@ -42,16 +42,16 @@ describe('getUserAgentWithOrchestrationId', () => { ) }) - test('preserves dots and hyphens in orchestration ID', () => { + test('preserves dots, hyphens, and underscores in orchestration ID', () => { const baseUserAgent = 'actions/github-script' - const orchestrationId = 'test.orchestration-123' + const orchestrationId = 'test.orchestration-123_abc' // Simulate the logic from getUserAgentWithOrchestrationId - const sanitized = orchestrationId.replace(/[^a-zA-Z0-9.-]/g, '') + const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '') const result = `${baseUserAgent} orchestration-id/${sanitized}` expect(result).toBe( - 'actions/github-script orchestration-id/test.orchestration-123' + 'actions/github-script orchestration-id/test.orchestration-123_abc' ) }) @@ -73,7 +73,7 @@ describe('getUserAgentWithOrchestrationId', () => { const orchestrationId = '@#$%^&*()' // Simulate the logic from getUserAgentWithOrchestrationId - const sanitized = orchestrationId.replace(/[^a-zA-Z0-9.-]/g, '') + const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '') const result = sanitized ? `${baseUserAgent} orchestration-id/${sanitized}` : baseUserAgent diff --git a/dist/index.js b/dist/index.js index 4138a02..a133e53 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36268,8 +36268,8 @@ function getUserAgentWithOrchestrationId(userAgent) { if (!orchestrationId) { return userAgent; } - // Sanitize orchestration ID - only keep alphanumeric, dots, and hyphens - const sanitized = orchestrationId.replace(/[^a-zA-Z0-9.-]/g, ''); + // Sanitize orchestration ID - only keep alphanumeric, dots, hyphens, and underscores + const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, ''); if (!sanitized) { return userAgent; } diff --git a/src/main.ts b/src/main.ts index bcf0740..3b32fc9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -34,8 +34,8 @@ function getUserAgentWithOrchestrationId(userAgent: string): string { return userAgent } - // Sanitize orchestration ID - only keep alphanumeric, dots, and hyphens - const sanitized = orchestrationId.replace(/[^a-zA-Z0-9.-]/g, '') + // Sanitize orchestration ID - only keep alphanumeric, dots, hyphens, and underscores + const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '') if (!sanitized) { return userAgent }