Skip to content

Commit 4ea7c5c

Browse files
committed
fix: resolve git state issues causing full project builds
- Use fetch-depth: 2 instead of conflicting fetch-depth: 0 + --depth=1 - Switch to reliable git diff HEAD~1 HEAD for maintenance branches - Eliminates issue where git show HEAD returned entire project history
1 parent f80a71c commit 4ea7c5c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.github/scripts/test_discovery.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ def _get_changed_files(self, base_ref: Optional[str] = None) -> List[str]:
6262
pr_head = os.environ.get('GITHUB_HEAD_HEAD') # PRs
6363
branch = os.environ.get('GITHUB_REF_NAME') # pushes
6464

65-
# For maintenance branches (cherry-picks), always use git show HEAD regardless of base_ref
65+
# For maintenance branches (cherry-picks), use single commit diff
6666
if branch and branch.endswith('.x'):
67-
# Maintenance branch - cherry-picks are single commits, just get files in this commit
68-
cmd = ["git", "show", "--name-only", "--format=", "HEAD"]
67+
# Maintenance branch - use diff with previous commit
68+
cmd = ["git", "diff", "--name-only", "HEAD~1", "HEAD"]
6969
elif base_ref:
7070
# Explicit base reference provided - use two-dot diff for direct comparison
7171
cmd = ["git", "diff", "--name-only", f"{base_ref}..HEAD"]
@@ -180,7 +180,7 @@ def _detect_default_base(self) -> str:
180180

181181
# Show the actual strategy being used
182182
if branch and branch.endswith('.x'):
183-
return f"git show HEAD (maintenance branch {branch})"
183+
return f"git diff HEAD~1 HEAD (maintenance branch {branch})"
184184
elif pr_base:
185185
return f"origin/{pr_base} (PR base)"
186186
elif branch:

.github/workflows/maintenance-fast.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
cancel-in-progress: true
1616
steps:
1717
- uses: actions/checkout@v4
18-
with: { fetch-depth: 2 } # Ensure we have at least HEAD~1 available
18+
with: { fetch-depth: 2 } # Need HEAD and HEAD~1 for single commit diff
1919

2020
- uses: actions/setup-java@v4
2121
with:

0 commit comments

Comments
 (0)