Skip to content

Commit 6f4baf7

Browse files
Merge pull request #45 from BitGo/DX-983-filter-summary-description
feat: filter out metadata-only changes
2 parents 0443f22 + 5b5efc7 commit 6f4baf7

File tree

6 files changed

+166
-8
lines changed

6 files changed

+166
-8
lines changed

.github/workflows/generate-release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ jobs:
7272
env:
7373
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7474
run: |
75+
if [ ! -s release-description.md ]; then
76+
echo "Release summary is empty, skipping release creation"
77+
exit 0
78+
fi
79+
80+
# Create GitHub Release
7581
gh release create ${{ steps.version.outputs.new_version }} \
7682
--title "${{ steps.version.outputs.new_version }}" \
7783
--notes-file final-release-description.md

scripts/api-diff.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,15 @@ function comparePaths() {
9393
if (!previousMethods[method]) {
9494
if (!changes.added[path]) changes.added[path] = new Set();
9595
changes.added[path].add(method.toUpperCase());
96-
} else if (JSON.stringify(previousMethods[method]) !== JSON.stringify(details)) {
97-
if (!changes.modified[path]) changes.modified[path] = [];
98-
changes.modified[path].push({
99-
method: method.toUpperCase(),
100-
changes: getChanges(previousMethods[method], details)
101-
});
96+
} else {
97+
const changedFields = getChanges(previousMethods[method], details);
98+
if (changedFields.length > 0) { // Only add if there are meaningful changes
99+
if (!changes.modified[path]) changes.modified[path] = [];
100+
changes.modified[path].push({
101+
method: method.toUpperCase(),
102+
changes: changedFields
103+
});
104+
}
102105
}
103106
});
104107
});
@@ -116,7 +119,7 @@ function comparePaths() {
116119

117120
function getChanges(previous, current) {
118121
const changes = [];
119-
const fields = ['summary', 'description', 'operationId', 'parameters', 'requestBody', 'responses'];
122+
const fields = ['operationId', 'parameters', 'requestBody', 'responses'];
120123

121124
fields.forEach(field => {
122125
if (JSON.stringify(previous[field]) !== JSON.stringify(current[field])) {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
## Modified
22
- [POST] `/user`
33
- responses
4-
- summary
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"openapi": "3.0.3",
3+
"info": {
4+
"title": "Test API",
5+
"description": "A sample API to for testing",
6+
"version": "1.0.0"
7+
},
8+
"servers": [
9+
{
10+
"url": "https://api.example.com/v1"
11+
}
12+
],
13+
"paths": {
14+
"/user": {
15+
"post": {
16+
"summary": "Creates a new user profile",
17+
"requestBody": {
18+
"required": true,
19+
"content": {
20+
"application/json": {
21+
"schema": {
22+
"$ref": "#/components/schemas/NewUser"
23+
}
24+
}
25+
}
26+
},
27+
"responses": {
28+
"201": {
29+
"description": "User created successfully",
30+
"content": {
31+
"application/json": {
32+
"schema": {
33+
"$ref": "#/components/schemas/User"
34+
}
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}
41+
},
42+
"components": {
43+
"schemas": {
44+
"User": {
45+
"type": "object",
46+
"properties": {
47+
"id": {
48+
"type": "string"
49+
},
50+
"name": {
51+
"type": "string"
52+
},
53+
"email": {
54+
"type": "string"
55+
}
56+
}
57+
},
58+
"NewUser": {
59+
"type": "object",
60+
"required": [
61+
"name",
62+
"email"
63+
],
64+
"properties": {
65+
"name": {
66+
"type": "string"
67+
},
68+
"email": {
69+
"type": "string"
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}

tests/fixtures/modified-summary/expected.md

Whitespace-only changes.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"openapi": "3.0.3",
3+
"info": {
4+
"title": "Test API",
5+
"description": "A sample API to for testing",
6+
"version": "1.0.0"
7+
},
8+
"servers": [
9+
{
10+
"url": "https://api.example.com/v1"
11+
}
12+
],
13+
"paths": {
14+
"/user": {
15+
"post": {
16+
"summary": "Create a new user profile",
17+
"requestBody": {
18+
"required": true,
19+
"content": {
20+
"application/json": {
21+
"schema": {
22+
"$ref": "#/components/schemas/NewUser"
23+
}
24+
}
25+
}
26+
},
27+
"responses": {
28+
"201": {
29+
"description": "User created successfully",
30+
"content": {
31+
"application/json": {
32+
"schema": {
33+
"$ref": "#/components/schemas/User"
34+
}
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}
41+
},
42+
"components": {
43+
"schemas": {
44+
"User": {
45+
"type": "object",
46+
"properties": {
47+
"id": {
48+
"type": "string"
49+
},
50+
"name": {
51+
"type": "string"
52+
},
53+
"email": {
54+
"type": "string"
55+
}
56+
}
57+
},
58+
"NewUser": {
59+
"type": "object",
60+
"required": [
61+
"name",
62+
"email"
63+
],
64+
"properties": {
65+
"name": {
66+
"type": "string"
67+
},
68+
"email": {
69+
"type": "string"
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)