-
Notifications
You must be signed in to change notification settings - Fork 533
Add ACTIONS_ORCHESTRATION_ID to user-agent string #695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: TingluoHuang <[email protected]>
Co-authored-by: TingluoHuang <[email protected]>
Co-authored-by: TingluoHuang <[email protected]>
Co-authored-by: TingluoHuang <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
src/main.ts
Outdated
| * @param userAgent The base user agent string | ||
| * @returns The user agent string with orchestration ID appended if ACTIONS_ORCHESTRATION_ID is set | ||
| */ | ||
| function getUserAgentWithOrchestrationId(userAgent: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot move the helper method to the end of the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the helper method to the end of the file in commit 8a9be95
package-lock.json
Outdated
| "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.0.tgz", | ||
| "integrity": "sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ==", | ||
| "dev": true, | ||
| "peer": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot why we need this? please undo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted package-lock.json changes in commit 8a9be95. The "peer": true flags were added by npm during the initial setup and are not needed.
Co-authored-by: TingluoHuang <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: TingluoHuang <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
src/main.ts
Outdated
| // Sanitize orchestration ID - only keep alphanumeric, dots, hyphens, and underscores | ||
| const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot replace invalid string with _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to replace invalid characters with underscore instead of removing them in commit 135f4fc
Example: test@#$123 now becomes test___123 instead of test123
|
Hello from actions/github-script! (3ecadc4) |
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot check CI failure and see if we need to fix our code or update the test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds the ACTIONS_ORCHESTRATION_ID environment variable to the user-agent string when making GitHub API requests. The orchestration ID is sanitized to ensure it only contains valid characters (alphanumeric, dots, dashes, and underscores) before being appended to the user-agent string in the format orchestration-id/{sanitized_id}.
Key changes:
- Added
getUserAgentWithOrchestrationIdhelper function to read, sanitize, and append the orchestration ID to the user-agent string - Modified user-agent construction in
main()to always use a base user-agent and append orchestration ID when available - Applied sanitization that replaces invalid characters with underscores
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main.ts | Added getUserAgentWithOrchestrationId function and integrated it into the main function's user-agent construction logic |
| dist/index.js | Compiled JavaScript output reflecting the TypeScript changes in main.ts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: TingluoHuang <[email protected]>
Fixed the CI failure in commit c36bdc0. The Integration test was failing because when user-agent was explicitly set to an empty string, the code was defaulting to "actions/github-script" instead of using an empty string. Updated the logic to correctly distinguish between:
|
@copilot i think we should update the tests. |
Co-authored-by: TingluoHuang <[email protected]>
Updated the integration test in commit c0078b2 to expect 'actions/github-script' prefix even when user-agent is set to an empty string. Also simplified the user-agent logic to always default empty input to 'actions/github-script' for consistency. |
src/main.ts
Outdated
| // Sanitize orchestration ID - replace invalid characters with underscore | ||
| const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '_') | ||
|
|
||
| return `${userAgent} orchestration-id/${sanitized}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot should be actions_orchestration_id/${sanitized}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the format to actions_orchestration_id/${sanitized} in commit b67a972.
Co-authored-by: TingluoHuang <[email protected]>

Implementation Plan
Changes Made
Updated orchestration ID format in
src/main.ts:orchestration-id/${sanitized}toactions_orchestration_id/${sanitized}Example user-agent string:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
https://github.com/github/actions-runtime/issues/5389