Skip to content

Restore authenticated ls-remote in signed commit push path#33178

Merged
pelikhan merged 6 commits into
mainfrom
copilot/fix-push-repo-memory-broken
May 19, 2026
Merged

Restore authenticated ls-remote in signed commit push path#33178
pelikhan merged 6 commits into
mainfrom
copilot/fix-push-repo-memory-broken

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

push_repo_memory regressed after actions/checkout moved to persist-credentials: false: push_signed_commits.cjs called git ls-remote without gitAuthEnv, so auth failed before branch state resolution and execution fell through to unsigned git push (rejected by signed-commit rulesets with GH013).

  • Auth propagation fix (runtime path)

    • Updated the network git ls-remote origin refs/heads/<branch> call in pushSignedCommits(...) to pass the same merged env already used by fallback push:
      • env: { ...process.env, ...(gitAuthEnv || {}) }
    • This restores per-process http.extraheader auth without reintroducing persisted checkout credentials.
  • Regression coverage (test path)

    • Added focused tests in push_signed_commits.test.cjs to assert that the signed-commit branch-resolution ls-remote call receives gitAuthEnv in exec.getExecOutput(...).
    • Added a guard-style assertion around the ls-remote network call so this omission is harder to reintroduce.
const { stdout: oidOut } = await exec.getExecOutput(
  "git",
  ["ls-remote", "origin", `refs/heads/${branch}`],
  { cwd, env: { ...process.env, ...(gitAuthEnv || {}) } }
);

Copilot AI and others added 3 commits May 19, 2026 00:42
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 ls-remote in signed commit push path May 19, 2026
Copilot AI requested a review from pelikhan May 19, 2026 00:49
@pelikhan pelikhan marked this pull request as ready for review May 19, 2026 00:51
Copilot AI review requested due to automatic review settings May 19, 2026 00:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.env and gitAuthEnv to ls-remote in pushSignedCommits.
  • Adds regression tests for auth env propagation to the ls-remote call.
  • Updates generated workflow lock files to use DD_APPLICATION_KEY in 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}",
@github-actions github-actions Bot mentioned this pull request May 19, 2026
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

Copilot AI and others added 2 commits May 19, 2026 01:47
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 19, 2026

@copilot review all comments

Done. I addressed the actionable review feedback:

  • tightened the ls-remote tests to assert merged process.env + gitAuthEnv with sentinel checks (9192184)
  • removed workflow lock-file churn from this PR scope (c723bd7)

Targeted test run passed: actions/setup/js/push_signed_commits.test.cjs.

Copilot AI requested a review from pelikhan May 19, 2026 01:53
@pelikhan pelikhan merged commit a88c44a into main May 19, 2026
@pelikhan pelikhan deleted the copilot/fix-push-repo-memory-broken branch May 19, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

push_repo_memory broken on signed-commit rulesets: ls-remote missing gitAuthEnv (regression from #31478)

3 participants