Skip to content

Commit 779e2f9

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 a0bd3e7 commit 779e2f9

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

.github/scripts/test_discovery.py

Lines changed: 3 additions & 3 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"]

.github/workflows/maintenance-fast.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ jobs:
1515
cancel-in-progress: true
1616
steps:
1717
- uses: actions/checkout@v4
18-
with: { fetch-depth: 0 }
19-
20-
- run: git fetch origin "$GITHUB_REF_NAME" --depth=1
18+
with: { fetch-depth: 2 } # Need HEAD and HEAD~1 for single commit diff
2119

2220
- uses: actions/setup-java@v4
2321
with:

0 commit comments

Comments
 (0)