fix(dep-guard): handle branches with no merge base#122
Conversation
The dependency-guard workflow crashes on orphan or diverged branches because git diff with three-dot syntax requires a merge base. This blocks downstream CI pipelines across tyk, tyk-analytics, and tyk-analytics-ui. Two changes: 1. Remove --depth=1 from the base ref fetch. The shallow fetch prevented git merge-base from finding common ancestors even for legitimate PRs, since the base ref had no parent chain locally. 2. Add a merge-base check before the diff. When no common ancestor exists (orphan branch, diverged release branch), fall back to comparing HEAD~1 against HEAD. Guard against single-commit branches where HEAD~1 does not exist. TT-17163 Signed-off-by: bsten-tyk <221599321+bsten-tyk@users.noreply.github.com>
|
This PR fixes a bug in the Files Changed Analysis
Architecture & Impact AssessmentWhat this PR accomplishes: Key technical changes introduced:
Affected system components:
New Logic Flow: flowchart TD
A[Start] --> B{Merge-base with origin/$BASE_REF exists?};
B -- Yes --> C[diff against base branch];
B -- No --> D[Log warning];
D --> E{"Parent commit (HEAD~1) exists?"};
E -- Yes --> F[diff against parent commit];
E -- No --> G["Skip diff (single-commit branch)"];
C --> H{Dependency files changed?};
F --> H;
G --> H;
H -- Yes --> I[Fail workflow];
H -- No --> J[Pass workflow];
Scope Discovery & Context ExpansionThis modification is within a reusable GitHub workflow, meaning its impact extends to all repositories that consume it. The fix is crucial for maintaining CI stability across projects, especially those employing release-branching strategies that result in divergent git histories. To fully assess the blast radius, one would search for all repositories in the organization that have a Metadata
Powered by Visor from Probelabs Last updated: 2026-05-08T13:40:50.841Z | Triggered by: pr_updated | Commit: 186b3ea 💡 TIP: You can chat with Visor using |
Security Issues (1)
✅ Performance Check PassedNo performance issues found – changes LGTM. Security Issues (1)
✅ Performance Check PassedNo performance issues found – changes LGTM. \n\nQuality Issues (1)
Powered by Visor from Probelabs Last updated: 2026-05-08T13:40:49.384Z | Triggered by: pr_updated | Commit: 186b3ea 💡 TIP: You can chat with Visor using |
|
@bsten-tyk I opened another PR to fix this issue #131. Can this be closed? |
Summary
HEAD~1 HEADcomparison for orphan/diverged branchesHEAD~1does not existWhy
The workflow crashes with
fatal: no merge baseon orphan or diverged branches (e.g.release-5.13.0).TT-17163