Improve breaking change CI (#12816)
It used to post a comment if the API schema changed, even if there's no breaking change. I thought this could be OK as an FYI. But it is not since now we generate the examples dynamically with Faker the OpenAPI schema is always different
This commit is contained in:
@ -28,6 +28,7 @@ jobs:
|
|||||||
packages/twenty-server/**
|
packages/twenty-server/**
|
||||||
packages/twenty-emails/**
|
packages/twenty-emails/**
|
||||||
packages/twenty-shared/**
|
packages/twenty-shared/**
|
||||||
|
.github/workflows/ci-breaking-changes.yaml
|
||||||
|
|
||||||
api-breaking-changes:
|
api-breaking-changes:
|
||||||
needs: changed-files-check
|
needs: changed-files-check
|
||||||
@ -462,23 +463,8 @@ jobs:
|
|||||||
' rest-api-diff.json >> rest-api-diff.md
|
' rest-api-diff.json >> rest-api-diff.md
|
||||||
|
|
||||||
elif [ "$different" = "true" ]; then
|
elif [ "$different" = "true" ]; then
|
||||||
echo "📝 Non-breaking changes detected ($new_endpoints new endpoints, $missing_endpoints removed, $changed_operations changed)"
|
echo "📝 Non-breaking changes detected ($new_endpoints new endpoints, $missing_endpoints removed, $changed_operations changed) - no PR comment will be posted"
|
||||||
|
# Don't create markdown file for non-breaking changes to avoid PR comments
|
||||||
# Generate non-breaking changes report
|
|
||||||
echo "# REST API Changes" > rest-api-diff.md
|
|
||||||
echo "" >> rest-api-diff.md
|
|
||||||
echo "## Summary" >> rest-api-diff.md
|
|
||||||
|
|
||||||
jq -r '
|
|
||||||
if (.newEndpoints | length) > 0 then
|
|
||||||
"### ✅ New Endpoints (" + (.newEndpoints | length | tostring) + ")\n" +
|
|
||||||
(.newEndpoints | map("- " + .method + " " + .pathUrl + ": " + (.summary // "")) | join("\n"))
|
|
||||||
else "" end,
|
|
||||||
if (.changedOperations | length) > 0 then
|
|
||||||
"\n### 🔄 Changed Operations (" + (.changedOperations | length | tostring) + ")\n" +
|
|
||||||
(.changedOperations | map("- " + .method + " " + .pathUrl + ": " + (.summary // "Modified operation")) | join("\n"))
|
|
||||||
else "" end
|
|
||||||
' rest-api-diff.json >> rest-api-diff.md
|
|
||||||
else
|
else
|
||||||
echo "✅ No changes detected in REST API"
|
echo "✅ No changes detected in REST API"
|
||||||
# Don't create diff file for no changes
|
# Don't create diff file for no changes
|
||||||
@ -522,13 +508,13 @@ jobs:
|
|||||||
if [ "$incompatible" = "true" ]; then
|
if [ "$incompatible" = "true" ]; then
|
||||||
echo "❌ Breaking changes detected in REST Metadata API"
|
echo "❌ Breaking changes detected in REST Metadata API"
|
||||||
|
|
||||||
# Generate breaking changes report
|
# Generate breaking changes report (only for breaking changes)
|
||||||
echo "# REST Metadata API Breaking Changes" > rest-metadata-api-diff.md
|
echo "# REST Metadata API Breaking Changes" > rest-metadata-api-diff.md
|
||||||
echo "" >> rest-metadata-api-diff.md
|
echo "" >> rest-metadata-api-diff.md
|
||||||
echo "⚠️ **Breaking changes detected that may affect existing API consumers**" >> rest-metadata-api-diff.md
|
echo "⚠️ **Breaking changes detected that may affect existing API consumers**" >> rest-metadata-api-diff.md
|
||||||
echo "" >> rest-metadata-api-diff.md
|
echo "" >> rest-metadata-api-diff.md
|
||||||
|
|
||||||
# Parse and format the changes from Java openapi-diff
|
# Parse and format the changes from Java openapi-diff
|
||||||
jq -r '
|
jq -r '
|
||||||
if (.missingEndpoints | length) > 0 then
|
if (.missingEndpoints | length) > 0 then
|
||||||
"## 🚨 Removed Endpoints (" + (.missingEndpoints | length | tostring) + ")\n" +
|
"## 🚨 Removed Endpoints (" + (.missingEndpoints | length | tostring) + ")\n" +
|
||||||
@ -545,26 +531,10 @@ jobs:
|
|||||||
' rest-metadata-api-diff.json >> rest-metadata-api-diff.md
|
' rest-metadata-api-diff.json >> rest-metadata-api-diff.md
|
||||||
|
|
||||||
elif [ "$different" = "true" ]; then
|
elif [ "$different" = "true" ]; then
|
||||||
echo "📝 Non-breaking changes detected ($new_endpoints new endpoints, $missing_endpoints removed, $changed_operations changed)"
|
echo "📝 Non-breaking changes detected ($new_endpoints new endpoints, $missing_endpoints removed, $changed_operations changed) - no PR comment will be posted"
|
||||||
|
# Don't create markdown file for non-breaking changes to avoid PR comments
|
||||||
# Generate non-breaking changes report
|
|
||||||
echo "# REST Metadata API Changes" > rest-metadata-api-diff.md
|
|
||||||
echo "" >> rest-metadata-api-diff.md
|
|
||||||
echo "## Summary" >> rest-metadata-api-diff.md
|
|
||||||
|
|
||||||
jq -r '
|
|
||||||
if (.newEndpoints | length) > 0 then
|
|
||||||
"### ✅ New Endpoints (" + (.newEndpoints | length | tostring) + ")\n" +
|
|
||||||
(.newEndpoints | map("- " + .method + " " + .pathUrl + ": " + (.summary // "")) | join("\n"))
|
|
||||||
else "" end,
|
|
||||||
if (.changedOperations | length) > 0 then
|
|
||||||
"\n### 🔄 Changed Operations (" + (.changedOperations | length | tostring) + ")\n" +
|
|
||||||
(.changedOperations | map("- " + .method + " " + .pathUrl + ": " + (.summary // "Modified operation")) | join("\n"))
|
|
||||||
else "" end
|
|
||||||
' rest-metadata-api-diff.json >> rest-metadata-api-diff.md
|
|
||||||
else
|
else
|
||||||
echo "✅ No changes detected in REST Metadata API"
|
echo "✅ No changes detected in REST Metadata API"
|
||||||
# Don't create diff file for no changes
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "⚠️ OpenAPI diff tool could not process the metadata API files"
|
echo "⚠️ OpenAPI diff tool could not process the metadata API files"
|
||||||
@ -675,7 +645,7 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check PR title for "breaking"
|
// Check PR title for "breaking"
|
||||||
const prTitle = "${{ github.event.pull_request.title }}";
|
const prTitle = `${{ github.event.pull_request.title }}`;
|
||||||
const titleContainsBreaking = prTitle.toLowerCase().includes('breaking');
|
const titleContainsBreaking = prTitle.toLowerCase().includes('breaking');
|
||||||
|
|
||||||
if (hasBreakingChanges) {
|
if (hasBreakingChanges) {
|
||||||
Reference in New Issue
Block a user