-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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]>
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.1 to 6.0.2. Release notes *Sourced from [actions/checkout's releases](https://github.com/actions/checkout/releases).* > v6.0.2 > ------ > > What's Changed > -------------- > > * Add orchestration\_id to git user-agent when ACTIONS\_ORCHESTRATION\_ID is set by [`@TingluoHuang`](https://github.com/TingluoHuang) in [actions/checkout#2355](https://github.com/actions/checkout/pull/2355) > * Fix tag handling: preserve annotations and explicit fetch-tags by [`@ericsciple`](https://github.com/ericsciple) in [actions/checkout#2356](https://github.com/actions/checkout/pull/2356) > > **Full Changelog**: <actions/checkout@v6.0.1...v6.0.2> Changelog *Sourced from [actions/checkout's changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md).* > Changelog > ========= > > v6.0.2 > ------ > > * Fix tag handling: preserve annotations and explicit fetch-tags by [`@ericsciple`](https://github.com/ericsciple) in [actions/checkout#2356](https://github.com/actions/checkout/pull/2356) > > v6.0.1 > ------ > > * Add worktree support for persist-credentials includeIf by [`@ericsciple`](https://github.com/ericsciple) in [actions/checkout#2327](https://github.com/actions/checkout/pull/2327) > > v6.0.0 > ------ > > * Persist creds to a separate file by [`@ericsciple`](https://github.com/ericsciple) in [actions/checkout#2286](https://github.com/actions/checkout/pull/2286) > * Update README to include Node.js 24 support details and requirements by [`@salmanmkc`](https://github.com/salmanmkc) in [actions/checkout#2248](https://github.com/actions/checkout/pull/2248) > > v5.0.1 > ------ > > * Port v6 cleanup to v5 by [`@ericsciple`](https://github.com/ericsciple) in [actions/checkout#2301](https://github.com/actions/checkout/pull/2301) > > v5.0.0 > ------ > > * Update actions checkout to use node 24 by [`@salmanmkc`](https://github.com/salmanmkc) in [actions/checkout#2226](https://github.com/actions/checkout/pull/2226) > > v4.3.1 > ------ > > * Port v6 cleanup to v4 by [`@ericsciple`](https://github.com/ericsciple) in [actions/checkout#2305](https://github.com/actions/checkout/pull/2305) > > v4.3.0 > ------ > > * docs: update README.md by [`@motss`](https://github.com/motss) in [actions/checkout#1971](https://github.com/actions/checkout/pull/1971) > * Add internal repos for checking out multiple repositories by [`@mouismail`](https://github.com/mouismail) in [actions/checkout#1977](https://github.com/actions/checkout/pull/1977) > * Documentation update - add recommended permissions to Readme by [`@benwells`](https://github.com/benwells) in [actions/checkout#2043](https://github.com/actions/checkout/pull/2043) > * Adjust positioning of user email note and permissions heading by [`@joshmgross`](https://github.com/joshmgross) in [actions/checkout#2044](https://github.com/actions/checkout/pull/2044) > * Update README.md by [`@nebuk89`](https://github.com/nebuk89) in [actions/checkout#2194](https://github.com/actions/checkout/pull/2194) > * Update CODEOWNERS for actions by [`@TingluoHuang`](https://github.com/TingluoHuang) in [actions/checkout#2224](https://github.com/actions/checkout/pull/2224) > * Update package dependencies by [`@salmanmkc`](https://github.com/salmanmkc) in [actions/checkout#2236](https://github.com/actions/checkout/pull/2236) > > v4.2.2 > ------ > > * `url-helper.ts` now leverages well-known environment variables by [`@jww3`](https://github.com/jww3) in [actions/checkout#1941](https://github.com/actions/checkout/pull/1941) > * Expand unit test coverage for `isGhes` by [`@jww3`](https://github.com/jww3) in [actions/checkout#1946](https://github.com/actions/checkout/pull/1946) > > v4.2.1 > ------ > > * Check out other refs/\* by commit if provided, fall back to ref by [`@orhantoy`](https://github.com/orhantoy) in [actions/checkout#1924](https://github.com/actions/checkout/pull/1924) > > v4.2.0 > ------ > > * Add Ref and Commit outputs by [`@lucacome`](https://github.com/lucacome) in [actions/checkout#1180](https://github.com/actions/checkout/pull/1180) > * Dependency updates by [`@dependabot`](https://github.com/dependabot)- [actions/checkout#1777](https://github.com/actions/checkout/pull/1777), [actions/checkout#1872](https://github.com/actions/checkout/pull/1872) > > v4.1.7 > ------ > > * Bump the minor-npm-dependencies group across 1 directory with 4 updates by [`@dependabot`](https://github.com/dependabot) in [actions/checkout#1739](https://github.com/actions/checkout/pull/1739) > * Bump actions/checkout from 3 to 4 by [`@dependabot`](https://github.com/dependabot) in [actions/checkout#1697](https://github.com/actions/checkout/pull/1697) > * Check out other refs/\* by commit by [`@orhantoy`](https://github.com/orhantoy) in [actions/checkout#1774](https://github.com/actions/checkout/pull/1774) > * Pin actions/checkout's own workflows to a known, good, stable version. by [`@jww3`](https://github.com/jww3) in [actions/checkout#1776](https://github.com/actions/checkout/pull/1776) > > v4.1.6 > ------ > > * Check platform to set archive extension appropriately by [`@cory-miller`](https://github.com/cory-miller) in [actions/checkout#1732](https://github.com/actions/checkout/pull/1732) ... (truncated) Commits * [`de0fac2`](actions/checkout@de0fac2) Fix tag handling: preserve annotations and explicit fetch-tags ([#2356](https://github.com/actions/checkout/issues/2356)) * [`064fe7f`](actions/checkout@064fe7f) Add orchestration\_id to git user-agent when ACTIONS\_ORCHESTRATION\_ID is set (... * See full diff in [compare view](actions/checkout@8e8c483...de0fac2) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps actions/checkout from 5.0.0 to 6.0.2. ## Release notes Sourced from actions/checkout's releases. v6.0.2 What's Changed Add orchestration_id to git user-agent when ACTIONS_ORCHESTRATION_ID is set by @TingluoHuang in actions/checkout#2355 Fix tag handling: preserve annotations and explicit fetch-tags by @ericsciple in actions/checkout#2356 Full Changelog: actions/checkout@v6.0.1...v6.0.2 v6.0.1 What's Changed Update all references from v5 and v4 to v6 by @ericsciple in actions/checkout#2314 Add worktree support for persist-credentials includeIf by @ericsciple in actions/checkout#2327 Clarify v6 README by @ericsciple in actions/checkout#2328 Full Changelog: actions/checkout@v6...v6.0.1 v6.0.0 What's Changed Update README to include Node.js 24 support details and requirements by @salmanmkc in actions/checkout#2248 Persist creds to a separate file by @ericsciple in actions/checkout#2286 v6-beta by @ericsciple in actions/checkout#2298 update readme/changelog for v6 by @ericsciple in actions/checkout#2311 Full Changelog: actions/checkout@v5.0.0...v6.0.0 v6-beta What's Changed Updated persist-credentials to store the credentials under $RUNNER_TEMP instead of directly in the local git config. This requires a minimum Actions Runner version of v2.329.0 to access the persisted credentials for Docker container action scenarios. v5.0.1 What's Changed Port v6 cleanup to v5 by @ericsciple in actions/checkout#2301 Full Changelog: actions/checkout@v5...v5.0.1 ## Changelog Sourced from actions/checkout's changelog. Changelog v6.0.2 Fix tag handling: preserve annotations and explicit fetch-tags by @ericsciple in actions/checkout#2356 v6.0.1 Add worktree support for persist-credentials includeIf by @ericsciple in actions/checkout#2327 v6.0.0 Persist creds to a separate file by @ericsciple in actions/checkout#2286 Update README to include Node.js 24 support details and requirements by @salmanmkc in actions/checkout#2248 v5.0.1 Port v6 cleanup to v5 by @ericsciple in actions/checkout#2301 v5.0.0 Update actions checkout to use node 24 by @salmanmkc in actions/checkout#2226 v4.3.1 Port v6 cleanup to v4 by @ericsciple in actions/checkout#2305 v4.3.0 docs: update README.md by @motss in actions/checkout#1971 Add internal repos for checking out multiple repositories by @mouismail in actions/checkout#1977 Documentation update - add recommended permissions to Readme by @benwells in actions/checkout#2043 Adjust positioning of user email note and permissions heading by @joshmgross in actions/checkout#2044 Update README.md by @nebuk89 in actions/checkout#2194 Update CODEOWNERS for actions by @TingluoHuang in actions/checkout#2224 Update package dependencies by @salmanmkc in actions/checkout#2236 v4.2.2 url-helper.ts now leverages well-known environment variables by @jww3 in actions/checkout#1941 Expand unit test coverage for isGhes by @jww3 in actions/checkout#1946 v4.2.1 Check out other refs/* by commit if provided, fall back to ref by @orhantoy in actions/checkout#1924 v4.2.0 Add Ref and Commit outputs by @lucacome in actions/checkout#1180 Dependency updates by @dependabot- actions/checkout#1777, actions/checkout#1872 v4.1.7 Bump the minor-npm-dependencies group across 1 directory with 4 updates by @dependabot in actions/checkout#1739 Bump actions/checkout from 3 to 4 by @dependabot in actions/checkout#1697 Check out other refs/* by commit by @orhantoy in actions/checkout#1774 Pin actions/checkout's own workflows to a known, good, stable version. by @jww3 in actions/checkout#1776 v4.1.6 Check platform to set archive extension appropriately by @cory-miller in actions/checkout#1732 ... (truncated) ## Commits de0fac2 Fix tag handling: preserve annotations and explicit fetch-tags (#2356) 064fe7f Add orchestration_id to git user-agent when ACTIONS_ORCHESTRATION_ID is set ( 8e8c483 Clarify v6 README (#2328) 033fa0d Add worktree support for persist-credentials includeIf (#2327) c2d88d3 Update all references from v5 and v4 to v6 (#2314) 1af3b93 update readme/changelog for v6 (#2311) 71cf226 v6-beta (#2298) 069c695 Persist creds to a separate file (#2286) ff7abcd Update README to include Node.js 24 support details and requirements (#2248) See full diff in compare view  Issue-ID: CIMAN-33 Signed-off-by: dependabot[bot] <[email protected]> Change-Id: I2efc697cecfe2aa7bb222b00975003050af2e33d GitHub-PR: #69 GitHub-Hash: b97dabb355259666 Signed-off-by: onap.gh2gerrit <[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