-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add orchestration_id to git user-agent when ACTIONS_ORCHESTRATION_ID is set #2355
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
Add orchestration_id to git user-agent when ACTIONS_ORCHESTRATION_ID is set #2355
Conversation
Co-authored-by: TingluoHuang <[email protected]>
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 pull request adds support for appending an orchestration ID to the Git HTTP user-agent string when the ACTIONS_ORCHESTRATION_ID environment variable is set, matching the implementation in actions/toolkit#2229.
Key Changes:
- Read
ACTIONS_ORCHESTRATION_IDfrom environment variables and sanitize it to allow only alphanumeric characters, underscores, hyphens, and periods - Append the sanitized orchestration ID as
actions_orchestration_id/{sanitized_id}to the Git HTTP user-agent - Add test coverage for orchestration ID presence, absence, and character sanitization scenarios
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/git-command-manager.ts | Implements orchestration ID reading, sanitization, and user-agent construction logic |
| dist/index.js | Compiled/transpiled version of the TypeScript changes |
| test/git-command-manager.test.ts | Adds test cases for orchestration ID scenarios (present, absent, sanitization) |
Comments suppressed due to low confidence (2)
test/git-command-manager.test.ts:468
- Consider adding test coverage for edge cases such as an empty string orchestration ID (ACTIONS_ORCHESTRATION_ID="") and an orchestration ID that becomes empty after sanitization (e.g., ACTIONS_ORCHESTRATION_ID="()///"). These edge cases could result in malformed user-agent strings like "git/2.18 (github-actions-checkout) actions_orchestration_id/".
})
test/git-command-manager.test.ts:415
- The test should verify that the GIT_HTTP_USER_AGENT environment variable is actually set correctly with the orchestration ID. Currently, it only verifies that the git command manager was created successfully, but doesn't assert that the user-agent contains "actions_orchestration_id/test-orch-id-12345". Consider inspecting the options.env parameter passed to mockExec to verify the environment variable is set as expected.
// The user agent should be set with orchestration ID
// We can't directly inspect gitEnv, but we verify the git command was created successfully
expect(git).toBeDefined()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
|
@copilot apply changes based on the comments in this thread |
… IDs Co-authored-by: TingluoHuang <[email protected]>
Applied all changes from the review comments. Tests now verify actual user-agent content, and the code properly handles empty orchestration IDs by checking for at least one alphanumeric character. All 95 tests passing. Commit: 4b87797 |
…d value Co-authored-by: TingluoHuang <[email protected]>
Co-authored-by: TingluoHuang <[email protected]>
Plan: Add orchestration_id to git user-agent
Based on the reference PR (actions/toolkit#2229), I need to:
git-command-manager.tsto include orchestration ID in the GIT_HTTP_USER_AGENTACTIONS_ORCHESTRATION_IDenvironment variableactions_orchestration_id/{sanitized_id}to the user agent if env var is setSummary
This PR successfully implements orchestration ID support in the git user-agent for the checkout action. The implementation:
✅ Follows the same pattern as actions/toolkit#2229
✅ Sanitizes orchestration ID values for security (allows only: 0-9, a-z, _, -, .)
✅ Accepts any non-empty sanitized value
✅ Includes comprehensive test coverage (3 new tests with actual assertions, all passing)
✅ Passes all existing tests (94/94 passing)
✅ Passes linter and format checks
✅ Has no security vulnerabilities
✅ Has no code review issues
The git user-agent will now include
actions_orchestration_id/{sanitized_id}when theACTIONS_ORCHESTRATION_IDenvironment variable is set and results in a non-empty string after sanitization.💡 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