Skip to content

Commit c5d2ccd

Browse files
committed
fix: resolve heavy CI triggering on maintenance branches and git history issues
1. Remove *.*.x from continuous-integration.yml triggers - Heavy CI/CD builds now only run on main branch - Maintenance branches use only the fast workflow 2. Fix git history availability in maintenance-fast.yml - Use fetch-depth: 2 to ensure HEAD~1 is available - Add debug logging for git state - Add fallback to "git show" when HEAD~1 not available 3. Improve error handling in test_discovery.py - Test for HEAD~1 existence before using it - Fallback to "git show --name-only HEAD" for shallow clones This should resolve both the duplicate heavy workflows and the git diff failures.
1 parent 2c748d9 commit c5d2ccd

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/scripts/test_discovery.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,17 @@ def _get_changed_files(self, base_ref: Optional[str] = None) -> List[str]:
6363
# For maintenance branches (cherry-picks), always use single commit diff
6464
if branch and branch.endswith('.x'):
6565
# Maintenance branch - cherry-picks are always single commits
66-
cmd = ["git", "diff", "--name-only", "HEAD~1..HEAD"]
66+
# Try HEAD~1..HEAD first, fallback to different strategies if not available
67+
try:
68+
# Test if HEAD~1 exists
69+
subprocess.run(["git", "rev-parse", "HEAD~1"],
70+
cwd=self.repo_root, check=True, capture_output=True)
71+
cmd = ["git", "diff", "--name-only", "HEAD~1..HEAD"]
72+
except subprocess.CalledProcessError:
73+
# HEAD~1 not available (shallow clone), try other approaches
74+
print("HEAD~1 not available, trying alternative approaches", file=sys.stderr)
75+
# Try showing just the files in the current commit
76+
cmd = ["git", "show", "--name-only", "--format=", "HEAD"]
6777
elif base_ref:
6878
# Explicit base reference provided - use two-dot diff for direct comparison
6979
cmd = ["git", "diff", "--name-only", f"{base_ref}..HEAD"]

.github/workflows/continuous-integration.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- '*.*.x'
87
workflow_dispatch:
98

109
jobs:

.github/workflows/maintenance-fast.yml

Lines changed: 5 additions & 4 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 } # Ensure we have at least HEAD~1 available
2119

2220
- uses: actions/setup-java@v4
2321
with:
@@ -33,7 +31,10 @@ jobs:
3331
- name: Show commit range
3432
run: |
3533
echo "Base ref: origin/$GITHUB_REF_NAME"
36-
git log --oneline "origin/$GITHUB_REF_NAME...HEAD"
34+
echo "HEAD commit: $(git rev-parse HEAD)"
35+
echo "HEAD~1 commit: $(git rev-parse HEAD~1 2>/dev/null || echo 'HEAD~1 not available')"
36+
echo "Recent commits:"
37+
git log --oneline -3 || echo "Git log failed"
3738
3839
- name: Compute impacted modules
3940
id: mods

0 commit comments

Comments
 (0)