Skip to content

Commit de2044b

Browse files
committed
Add optional fetch_depth parameter for performance optimization
- Add fetch_depth input parameter to action.yml with default value of '0' - Document fetch_depth in README.md inputs table - Add Performance Optimization section to README.md explaining shallow clone benefits - Update all example workflows with helpful fetch-depth comments - Enables users to use shallow clones (fetch-depth: 1) for faster checkouts in large repos - Maintains backward compatibility with default full history behavior
1 parent 3fbe40c commit de2044b

File tree

6 files changed

+26
-4
lines changed

6 files changed

+26
-4
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,23 @@ Each example includes a complete workflow file that you can copy to your `.githu
6464

6565
## Advanced
6666

67+
### Performance Optimization
68+
69+
For large repositories with extensive history, you can significantly speed up the checkout process by using a shallow clone:
70+
71+
```yaml
72+
- uses: actions/checkout@v4
73+
with:
74+
fetch-depth: 1 # Shallow clone for faster checkout
75+
```
76+
77+
The `fetch-depth` parameter controls how much history is fetched:
78+
- `fetch-depth: 1` - Only the latest commit (fastest for most use cases)
79+
- `fetch-depth: 50` - Last 50 commits (balance between speed and history)
80+
- `fetch-depth: 0` - Full history (slowest but complete, default behavior)
81+
82+
For most PR reviews and code analysis, a shallow clone (`fetch-depth: 1`) provides sufficient context while significantly reducing checkout time.
83+
6784
### Inputs
6885

6986
| Input | Description | Required | Example |
@@ -82,6 +99,7 @@ Each example includes a complete workflow file that you can copy to your `.githu
8299
| `model` | Model to use; passed through to auggie as --model | No | e.g. `sonnet4`, from `auggie --list-models` |
83100
| `rules` | JSON array of rules file paths (each forwarded as individual `--rules` flags) | No | `'[".github/augment/rules.md"]'` |
84101
| `mcp_configs` | JSON array of MCP config file paths (each forwarded as individual `--mcp-config` flags) | No | `'[".augment/mcp/config.json"]'` |
102+
| `fetch_depth` | Number of commits to fetch. Use `0` for full history (default), `1` for shallow clone, or any positive integer for specific depth | No | `1` (shallow), `50` (last 50 commits), `0` (full) |
85103

86104
\*Either `instruction`, `instruction_file`, or `template_directory` must be provided.
87105

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ inputs:
4949
mcp_configs:
5050
description: "JSON array of MCP config file paths. Each entry is forwarded to auggie as an individual --mcp-config flag."
5151
required: false
52+
fetch_depth:
53+
description: "Number of commits to fetch. Use '0' for full history (default), '1' for shallow clone (latest commit only), or any positive integer for a specific depth."
54+
required: false
55+
default: "0"
5256

5357
runs:
5458
using: "composite"

example-workflows/code-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111
with:
12-
fetch-depth: 0
12+
fetch-depth: 0 # Use fetch-depth: 1 for shallow clone (faster), or fetch-depth: 0 for full history
1313
- name: Create instruction file
1414
env:
1515
PR_NUMBER: ${{ github.event.pull_request.number }}

example-workflows/pr-description.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111
with:
12-
fetch-depth: 0
12+
fetch-depth: 0 # Use fetch-depth: 1 for shallow clone (faster), or fetch-depth: 0 for full history
1313
- name: Create instruction file
1414
env:
1515
PR_NUMBER: ${{ github.event.pull_request.number }}

example-workflows/template-pr-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111
with:
12-
fetch-depth: 0
12+
fetch-depth: 0 # Use fetch-depth: 1 for shallow clone (faster), or fetch-depth: 0 for full history
1313

1414
- name: Create template directory
1515
run: |

example-workflows/triage-issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v4
1111
with:
12-
fetch-depth: 0
12+
fetch-depth: 0 # Use fetch-depth: 1 for shallow clone (faster), or fetch-depth: 0 for full history
1313
- name: Create instruction file
1414
env:
1515
ISSUE_NUMBER: ${{ github.event.issue.number }}

0 commit comments

Comments
 (0)