Restore authenticated ls-remote in signed commit push path#33178
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix push_repo_memory broken on signed-commit rulesets
Restore authenticated May 19, 2026
ls-remote in signed commit push path
pelikhan
approved these changes
May 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Restores authenticated git ls-remote for the signed-commit push path so branch resolution works when checkout credentials are not persisted.
Changes:
- Passes merged
process.envandgitAuthEnvtols-remoteinpushSignedCommits. - Adds regression tests for auth env propagation to the
ls-remotecall. - Updates generated workflow lock files to use
DD_APPLICATION_KEYin Datadog MCP headers.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/push_signed_commits.cjs |
Adds gitAuthEnv propagation to branch-resolution ls-remote. |
actions/setup/js/push_signed_commits.test.cjs |
Adds focused tests for authenticated ls-remote behavior. |
.github/workflows/smoke-otel-backends.lock.yml |
Updates Datadog MCP header variable in generated workflow config. |
.github/workflows/mcp-inspector.lock.yml |
Updates Datadog MCP header variable in generated workflow config. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
actions/setup/js/push_signed_commits.test.cjs:811
- This second test repeats almost the entire setup from the previous test and exercises the same path. The additional
toHaveLength(1)guard could be folded into the first test to reduce maintenance cost and avoid creating another full repository fixture for the same behavior.
it("should include auth env on ls-remote getExecOutput git call", async () => {
const gitAuthEnv = {
GIT_CONFIG_COUNT: "1",
GIT_CONFIG_KEY_0: "http.https://github.com/.extraheader",
GIT_CONFIG_VALUE_0: "Authorization: basic test-token",
};
const getExecOutput = vi.fn(async (_program, args) => {
- Files reviewed: 4/4 changed files
- Comments generated: 3
Comment on lines
+783
to
+801
|
|
||
| await pushSignedCommits({ | ||
| githubClient, | ||
| owner: "test-owner", | ||
| repo: "test-repo", | ||
| branch: "auth-check-branch", | ||
| baseRef: "origin/main", | ||
| cwd: workDir, | ||
| gitAuthEnv, | ||
| }); | ||
|
|
||
| const lsRemoteCall = getExecOutput.mock.calls.find(call => call[1][0] === "ls-remote"); | ||
| expect(lsRemoteCall).toBeDefined(); | ||
| expect(lsRemoteCall[2]).toEqual( | ||
| expect.objectContaining({ | ||
| cwd: workDir, | ||
| env: expect.objectContaining(gitAuthEnv), | ||
| }) | ||
| ); |
| "headers": { | ||
| "DD_API_KEY": "\${DD_API_KEY}", | ||
| "DD_APPLICATION_KEY": "\${DD_APP_KEY}", | ||
| "DD_APPLICATION_KEY": "\${DD_APPLICATION_KEY}", |
| "headers": { | ||
| "DD_API_KEY": "\${DD_API_KEY}", | ||
| "DD_APPLICATION_KEY": "\${DD_APP_KEY}", | ||
| "DD_APPLICATION_KEY": "\${DD_APPLICATION_KEY}", |
Collaborator
|
@copilot review all comments |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Done. I addressed the actionable review feedback:
Targeted test run passed: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
push_repo_memoryregressed afteractions/checkoutmoved topersist-credentials: false:push_signed_commits.cjscalledgit ls-remotewithoutgitAuthEnv, so auth failed before branch state resolution and execution fell through to unsignedgit push(rejected by signed-commit rulesets with GH013).Auth propagation fix (runtime path)
git ls-remote origin refs/heads/<branch>call inpushSignedCommits(...)to pass the same merged env already used by fallback push:env: { ...process.env, ...(gitAuthEnv || {}) }http.extraheaderauth without reintroducing persisted checkout credentials.Regression coverage (test path)
push_signed_commits.test.cjsto assert that the signed-commit branch-resolutionls-remotecall receivesgitAuthEnvinexec.getExecOutput(...).ls-remotenetwork call so this omission is harder to reintroduce.