git.clone
action is one of the most fundamental building blocks in Overcut workflows. It allows you to clone Git repositories into the workflow execution environment, providing agents and subsequent steps with access to your source code for analysis, modification, or review.
Overview
Thegit.clone
action performs a Git clone operation with intelligent caching, branch management, and advanced clone options. It’s designed to be fast, reliable, and configurable for different use cases.
Smart Caching
Automatically uses cached repositories when possible, dramatically reducing clone time for subsequent runs.
Branch Management
Clone specific branches or use the repository’s default branch with automatic checkout.
Advanced Options
Support for shallow clones, sparse checkouts, partial clones, and more Git optimization features.
Error Handling
Robust error handling with detailed logging and fallback mechanisms.
Basic Usage
Simple Repository Clone
The most basic usage clones a repository using its default branch:Clone Specific Branch
Clone a specific branch instead of the default:Using Dynamic Values
Reference values from the trigger or previous steps:Parameters
Required Parameters
Organization/Repository full name in “owner/repo” format. This is the only required parameter for the git.clone action.
Optional Parameters
Specific branch to checkout. If not specified, the repository’s default branch will be used.
Advanced Git clone configuration options for fine-grained control over the clone operation.
Clone Options
ThecloneOptions
parameter provides fine-grained control over the clone operation:
Depth Control
Limit the clone depth for faster downloads:1
: Latest commit only (fastest, minimal history)0
: Full history (slowest, most disk usage)- Any positive integer for custom depth
Single Branch Clone
Clone only the specified branch to reduce download size:Sparse Checkout
Clone only specific directories or files:Cache Incompatibility: Sparse checkout forces a full clone and cannot use repository caching, as it fundamentally changes the repository structure. This means every run will perform a fresh clone, which may be slower but ensures the correct file structure for your workflow.
- Faster downloads for large repositories
- Reduced disk space usage
- Focus on relevant code sections
- Ideal for monorepos or large projects
Partial Clone Filters
Use Git’s partial clone feature to skip large files:"blob:none"
: Skip all file contents (fastest, metadata only)"blob:limit=100M"
: Skip files larger than 100MB"combine"
: Apply multiple filters together
Force Fresh Clone
Bypass cache and force a fresh clone:ignoreCache
:
- Debugging cache-related issues
- Testing with fresh dependencies
- Ensuring latest code changes
- Troubleshooting workflow problems
Complete Examples
Code Review Workflow
Clone a repository for code review with optimization:Documentation Generation
Clone only documentation-related files:Large Repository Analysis
Optimize for large repositories with partial cloning:Caching Behavior
Automatic Cache Usage
Overcut automatically uses cached repositories when possible:- Cache Eligibility: Determined by clone options
- Cache Refresh: Automatic background refresh every 10 days
- Cache Invalidation: Stale caches (20+ days) are ignored
- Non-blocking: Cache operations never block workflow execution
Cache Compatibility
Clone Option | Cache Compatible |
---|---|
depth | ✅ Yes |
singleBranch | ✅ Yes |
filter | ✅ Yes |
sparseCheckout | ❌ No |
ignoreCache: true | ❌ No |
Cache Performance
- First Run: Normal clone time (creates cache)
- Subsequent Runs: 90%+ faster using cache
- Cache Hit Rate: Typically 95%+ for active repositories
- Background Refresh: Automatic updates without blocking workflows
Output and Context
Step Output
Thegit.clone
action provides output that can be used by subsequent steps:
Full path to the cloned repository in the workspace.
Whether the repository was loaded from cache (true) or freshly cloned (false).
Whether dependencies are already installed in the cached repository.
Available Variables
Use these variables in subsequent steps:{{outputs.clone-repo.workspacePath}}
: Full path to the cloned repository{{outputs.clone-repo.fromCache}}
: Whether cache was used{{outputs.clone-repo.dependenciesInstalledOnCache}}
: Whether dependencies are already installed
Repository Context
The cloned repository is automatically added to the workflow context:- Repository Information: Name, provider, organization
- Authentication: Automatic token management
- Correlations: Links to related tickets and issues
- Secrets: Repository-specific environment variables
Error Handling
Common Errors
Missing
repoFullName
parameter. Ensure repoFullName
is set in your workflow step.Specified branch doesn’t exist. Check branch name or use the repository’s default branch.
Insufficient repository access. Verify repository permissions and authentication.
Large repository or slow network. Use depth limits or filters to optimize.
Best Practices
General Guidelines
- Always specify
repoFullName
: Use the full “owner/repo” format - Use appropriate depth: Balance between speed and history needs
- Leverage caching: Don’t use
ignoreCache
unless necessary - Consider sparse checkout: For workflows that only need specific files
- Monitor performance: Use logs to identify optimization opportunities
Next Steps
Now that you understand thegit.clone
action, explore these related topics:
- Repository Caching: Learn how caching improves performance
- Repository Mapping: Understand automatic repository identification
- Building Blocks: Explore other workflow actions and components
- Quick Starts: See complete workflow examples