Skip to content

Optimize safe output checkout with shallow clone and targeted branch fetching - #7176

Merged
pelikhan merged 6 commits into
mainfrom
copilot/add-shallow-checkout-step
Dec 22, 2025
Merged

Optimize safe output checkout with shallow clone and targeted branch fetching#7176
pelikhan merged 6 commits into
mainfrom
copilot/add-shallow-checkout-step

Conversation

CopilotAI commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Safe output jobs for create-pull-request and push-to-pull-request-branch performed full repository checkouts (fetch-depth: 0), which is expensive for large repositories. This changes them to shallow clones with explicit branch fetching.

Changes

Go compiler changes:

  • Modified buildCreatePullRequestPreStepsConsolidated() and buildPushToPullRequestBranchPreStepsConsolidated() to use fetch-depth: 1 instead of fetch-depth: 0

JavaScript runtime changes:

  • create_pull_request.cjs: Replaced git fetch origin with git fetch origin ${baseBranch}:${baseBranch} to fetch only the base branch
  • push_to_pull_request_branch.cjs: Replaced git fetch origin with git fetch origin ${branchName}:refs/remotes/origin/${branchName} to fetch only the target branch

Example

Before:

awaitexec.exec("git fetch origin");// Fetches all branchesawaitexec.exec(`git checkout ${baseBranch}`);

After:

awaitexec.exec(`git fetch origin ${baseBranch}:${baseBranch}`);// Fetches only needed branchawaitexec.exec(`git checkout ${baseBranch}`);

This reduces clone time and network transfer significantly for repositories with extensive history.

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:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login oad-artifact.git php8.3 /usr/bin/git l 4 /usr/bin/git git for-�� b/workflows %(refname) /usr/bin/git l a255aa63a3cc5ba3rev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login it/ref/tags/v5 git (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login ithub/workflows origin e/git-remote-https xterm-color (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

The safe output job should emit a shallow checkout step for the create-pull-request or push-to-pull-request-branch because some repositories are huge and it is an expensive task.

Instead, the JavaScript should run git command to ensure that the branches required are available.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

CopilotAIand others added 3 commits December 22, 2025 00:33
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Changed fetch-depth from 0 to 1 for create-pull-request and push-to-pull-request-branch safe outputs.
JavaScript now explicitly fetches required branches using git commands.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title [WIP] Add shallow checkout step for safe output jobOptimize safe output checkout with shallow clone and targeted branch fetchingDec 22, 2025
CopilotAI requested a review from pelikhanDecember 22, 2025 00:51
@github-actions

github-actionsBot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions

github-actionsBot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

🤖 DIAGNOSTIC COMPLETE: Smoke Copilot No Firewall STATUS: ALL_UNITS_OPERATIONAL. MISSION_SUCCESS.

@github-actions

github-actionsBot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actionsBot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actionsBot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

🎉 Yo ho ho! Smoke Copilot Safe Inputs found the treasure and completed successfully! ⚓💰

@github-actions

github-actionsBot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions

github-actionsBot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

✅ Firewall validation complete... Smoke Codex Firewall confirmed network sandboxing is operational. 🛡️

@github-actions

github-actionsBot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

🎬 THE ENDSmoke ClaudeMISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results - Copilot Engine

Last 2 merged PRs:

Test Results:

  • ✅ GitHub MCP: Accessed merged PRs
  • ✅ File Writing: Created & verified test file
  • ✅ Bash Tool: Executed commands successfully
  • ✅ Default Toolset: get_me correctly unavailable
  • ✅ Cache Memory: Read/write successful

Overall Status: PASS

cc: @pelikhan

📰 BREAKING: Report filed by Smoke Copilot fer issue #7176 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results

File Writing: Created /tmp/gh-aw/agent/smoke-test-copilot-20418939388.txt
Bash Tool: Verified file content successfully
Safe Input gh Tool: safeinputs-gh tool not available

Status: PARTIAL PASS (2/3 tests passed)

Ahoy! This treasure was crafted by 🏴‍☠️ Smoke Copilot Safe Inputs fer issue #7176 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results: Copilot Engine (No Firewall)

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved PRs successfully
  • ✅ File Writing: Created test file in /tmp/gh-aw/agent/
  • ✅ Bash Tool: Verified file creation (Mon Dec 22 01:22:39 UTC 2025)
  • ✅ Playwright MCP: Navigated to github.com, title contains "GitHub"
  • ⏳ Safe Input gh Tool: Testing now...

Status: Running final test

🤖 DIAGNOSTIC REPORT GENERATED BY Smoke Copilot No Firewall fer issue #7176 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

Firewall smoke test (Codex + AWF)
PRs: [security-fix] Fix clear-text logging of sensitive information in secrets validation; [docs] Update documentation for shorthand label trigger syntax
OpenAI curl blocked: ✅
example.com blocked: ✅
GitHub MCP (PR titles fetched): ✅
File write/read: ✅ (/tmp/gh-aw/agent/smoke-test-codex-firewall-20418939393.txt)
Network: SANDBOXED | Overall: PASS

🔥 Firewall tested by Smoke Codex Firewall fer issue #7176 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results - Claude Engine

Last 2 Merged PRs:

Test Results:
✅ GitHub MCP - Retrieved PRs successfully
✅ File Writing - Created /tmp/gh-aw/agent/smoke-test-claude-20418939409.txt
✅ Bash Tool - Verified file creation
✅ Playwright MCP - Navigated to GitHub, title verified: "GitHub · Change is constant. GitHub keeps you ahead. · GitHub"
✅ Cache Memory - Created /tmp/gh-aw/cache-memory/smoke-test-20418939409.txt
❌ Safe Input gh Tool - Tool not available in this environment

Status: PASS (5/6 core tests passed)

💥 [THE END] — Illustrated by Smoke Claude fer issue #7176 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

Recent merged PRs: [security-fix] Fix clear-text logging of sensitive information in secrets validation; [docs] Update documentation for shorthand label trigger syntax
GitHub MCP (last 2 merged PRs): ✅
File write /tmp/gh-aw/agent & cat: ✅
Playwright title contains "GitHub": ✅
Cache memory file write & cat: ✅
safeinputs-gh gh issues list --limit 3: ❌ (command not found)
Overall status: FAIL

🔮 The oracle has spoken through Smoke Codex fer issue #7176 🗺️

@pelikhan
pelikhan marked this pull request as ready for review December 22, 2025 01:24
@pelikhan
pelikhan merged commit 635b809 into mainDec 22, 2025
5 checks passed
@pelikhan
pelikhan deleted the copilot/add-shallow-checkout-step branch December 22, 2025 01:25
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@pelikhan@actions-user