Skip to content

Commit 313b042

Browse files
authored
Update breaking-change-detector.yml
1 parent e5e15a8 commit 313b042

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

.github/workflows/breaking-change-detector.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616
with:
17-
fetch-depth: 0 # Required for griffe.load_git to access main branch history
17+
fetch-depth: 0 # Required for griffe.load_git to access 'main' history
1818

1919
- name: Set up Python
2020
uses: actions/setup-python@v5
@@ -25,42 +25,42 @@ jobs:
2525
uses: astral-sh/setup-uv@v5
2626

2727
- name: Install dependencies
28-
# Syncing extras (like test) ensures 'google-auth' and other 'google.*'
29-
# namespaces are populated, preventing ModuleNotFound errors.
28+
# 1. uv sync installs the SDK (google-auth, pydantic, etc.)
29+
# 2. uv pip install griffe ensures the detector tool is in the venv
3030
run: |
3131
uv sync --extra test
3232
uv pip install griffe
3333
3434
- name: Run Breaking Change Detection
35-
shell: python
35+
# Using 'uv run python' is the key: it automatically runs the script
36+
# inside the .venv created in the previous step, so both 'griffe'
37+
# and 'google' are found.
3638
run: |
39+
uv run python - <<EOF
3740
import sys
3841
import griffe
3942
from griffe import find_breaking_changes, load, load_git
4043
41-
# The package 'google.adk' is located inside the 'src' directory.
42-
# Specifying search_paths=["src"] allows Griffe to find it.
4344
try:
44-
print("Loading current API version...")
45+
print("Loading current API (from PR)...")
46+
# We use 'google.adk' and tell Griffe to look in 'src'
4547
new_api = load("google.adk", search_paths=["src"])
4648
47-
print("Loading baseline API version from main branch...")
48-
# load_git automatically handles the temporary checkout of the ref.
49+
print("Loading baseline API (from main branch)...")
50+
# search_paths=["src"] is also required here to find the package in the worktree
4951
old_api = load_git("google.adk", ref="main", search_paths=["src"])
5052
51-
print("Comparing versions for breaking changes...")
53+
print("Comparing for breaking changes...")
5254
breakages = list(find_breaking_changes(old_api, new_api))
5355
5456
if breakages:
55-
# Annotation for GitHub Actions UI
5657
print(f"::error::Found {len(breakages)} breaking changes!")
5758
for breakage in breakages:
58-
# .explain() provides details on what was removed or changed
5959
print(breakage.explain())
6060
sys.exit(1)
6161
6262
print("Success: No breaking changes detected.")
6363
except Exception as e:
64-
# If Griffe fails (e.g., due to the 'google' module error), we fail the check.
6564
print(f"::error::Breaking change detection failed: {e}")
6665
sys.exit(1)
66+
EOF

0 commit comments

Comments
 (0)