Skip to content

Commit ffefa45

Browse files
refactor: simplify API check workflow and add baseline comparison
- Remove separate griffe installation (already in test dependency group) - Remove GitHub Actions output and script reporting - Add --verbose flag for better output - Configure griffe to compare against latest PyPI version as baseline - Simplify workflow to let griffe's output do the work This provides meaningful API stability checks by comparing current code against the latest released version on PyPI.
1 parent df7939a commit ffefa45

File tree

1 file changed

+11
-43
lines changed

1 file changed

+11
-43
lines changed

.github/workflows/api-check.yml

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -32,50 +32,18 @@ jobs:
3232
uses: astral-sh/setup-uv@v6
3333

3434
- name: Install dependencies
35-
run: |
36-
uv sync --group test
37-
uv pip install griffe
35+
run: uv sync --group test
3836

39-
- name: Run griffe API check
40-
id: griffe-check
41-
continue-on-error: true
37+
- name: Check API stability against PyPI
4238
run: |
43-
echo "Running griffe API stability check..."
44-
if uv run griffe check setuptools_scm -ssrc -f github; then
45-
echo "api_check_result=success" >> $GITHUB_OUTPUT
46-
echo "exit_code=0" >> $GITHUB_OUTPUT
47-
else
48-
exit_code=$?
49-
echo "api_check_result=warning" >> $GITHUB_OUTPUT
50-
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
51-
exit $exit_code
39+
# Get the latest version from PyPI
40+
LATEST_VERSION=$(uv pip show setuptools-scm 2>/dev/null | grep "^Version:" | cut -d' ' -f2 || echo "")
41+
if [ -z "$LATEST_VERSION" ]; then
42+
echo "No PyPI version found, installing latest release..."
43+
uv pip install setuptools-scm
44+
LATEST_VERSION=$(uv pip show setuptools-scm | grep "^Version:" | cut -d' ' -f2)
5245
fi
46+
echo "Comparing against PyPI version: $LATEST_VERSION"
5347
54-
- name: Report API check result
55-
if: always()
56-
uses: actions/github-script@v8
57-
with:
58-
script: |
59-
const result = '${{ steps.griffe-check.outputs.api_check_result }}'
60-
const exitCode = '${{ steps.griffe-check.outputs.exit_code }}'
61-
62-
if (result === 'success') {
63-
core.notice('API stability check passed - no breaking changes detected')
64-
await core.summary
65-
.addHeading('✅ API Stability Check: Passed', 2)
66-
.addRaw('No breaking changes detected in the public API')
67-
.write()
68-
} else if (result === 'warning') {
69-
core.warning(`API stability check detected breaking changes (exit code: ${exitCode}). Please review the API changes above.`)
70-
await core.summary
71-
.addHeading('⚠️ API Stability Warning', 2)
72-
.addRaw('Breaking changes detected in the public API. Please review the changes reported above.')
73-
.addRaw(`\n\nExit code: ${exitCode}`)
74-
.write()
75-
} else {
76-
core.error('API stability check failed to run properly')
77-
await core.summary
78-
.addHeading('❌ API Stability Check: Failed', 2)
79-
.addRaw('The griffe check failed to execute. This may indicate griffe is not installed or there was an error.')
80-
.write()
81-
}
48+
# Compare current code against PyPI version
49+
uv run griffe check setuptools_scm -ssrc --verbose --against "setuptools-scm==$LATEST_VERSION"

0 commit comments

Comments
 (0)