Skip to content

Commit e0c821c

Browse files
update github workflow
1 parent 1abfbda commit e0c821c

2 files changed

Lines changed: 36 additions & 20 deletions

File tree

.github/workflows/update-api-docs.yml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,47 @@ jobs:
6363
# Make script executable
6464
chmod +x scripts/create-merged-openapi.py
6565
66-
# Run script to create openapi.json with only endpoints from "API Reference - Partners"
67-
python3 scripts/create-merged-openapi.py
66+
# Run script to create openapi-mcp.json with only endpoints from "API Reference - Partners"
67+
# The script will create openapi-mcp.json instead of openapi.json
68+
OUTPUT_FILE=openapi-mcp.json python3 scripts/create-merged-openapi.py
6869
6970
echo "✅ OpenAPI file for MCP created!"
71+
echo " - Filtered/merged spec saved to openapi-mcp.json (for MCP)"
7072
echo " - Contains only endpoints explicitly listed in 'API Reference - Partners'"
7173
echo " - Includes Customer API endpoints + additional Partners endpoints"
7274
echo " - All endpoints have MCP enabled"
7375
74-
- name: Validate OpenAPI spec
76+
- name: Save full Customer API spec for API Reference tab
7577
run: |
76-
echo "🔍 Validating merged OpenAPI specification..."
78+
echo "💾 Saving full Customer API spec for 'API Reference' tab..."
79+
# Copy the full Customer API spec to openapi.json for the API Reference tab
80+
# This ensures the API Reference tab shows all Customer API endpoints, not just filtered ones
81+
cp openapi-customer.json openapi.json
82+
echo "✅ Full Customer API spec saved to openapi.json"
83+
echo " - This file is used by the 'API Reference' tab in docs.json"
84+
echo " - Contains all Customer API endpoints from https://api-doc.trykintsugi.com/openapi.json"
85+
86+
- name: Validate OpenAPI specs
87+
run: |
88+
echo "🔍 Validating OpenAPI specifications..."
7789
78-
# Check if merged file exists and is not empty
90+
# Validate full Customer API spec (for API Reference tab)
7991
if [ ! -s openapi.json ]; then
80-
echo "❌ Merged OpenAPI spec is empty or missing"
92+
echo "❌ Customer API spec (openapi.json) is empty or missing"
8193
exit 1
8294
fi
95+
customer_path_count=$(jq '.paths | length' openapi.json)
96+
echo "✅ Customer API spec (openapi.json) contains $customer_path_count paths"
8397
84-
# Verify MCP configuration
85-
echo "🔍 Verifying MCP configuration..."
86-
jq -e '."x-mint".mcp.enabled == true' openapi.json > /dev/null && echo "✅ Merged OpenAPI has MCP enabled" || echo "❌ Merged OpenAPI missing MCP config"
87-
88-
# Count paths
89-
path_count=$(jq '.paths | length' openapi.json)
90-
echo "✅ Merged OpenAPI spec contains $path_count paths"
98+
# Validate MCP filtered spec (if it exists)
99+
if [ -s openapi-mcp.json ]; then
100+
echo "🔍 Verifying MCP configuration..."
101+
jq -e '."x-mint".mcp.enabled == true' openapi-mcp.json > /dev/null && echo "✅ MCP OpenAPI has MCP enabled" || echo "❌ MCP OpenAPI missing MCP config"
102+
mcp_path_count=$(jq '.paths | length' openapi-mcp.json)
103+
echo "✅ MCP OpenAPI spec contains $mcp_path_count paths"
104+
fi
91105
92-
echo "✅ OpenAPI spec is valid!"
106+
echo "✅ All OpenAPI specs are valid!"
93107
94108
- name: Generate API documentation
95109
run: |
@@ -118,15 +132,16 @@ jobs:
118132
git config user.name "GitHub Actions"
119133
git config user.email "actions@github.com"
120134
121-
# Add all changes (source OpenAPI files + merged OpenAPI file + generated docs)
122-
git add openapi-customer.json openapi-partners.json openapi.json reference/api/
135+
# Add all changes (source OpenAPI files + Customer API spec + MCP spec + generated docs)
136+
git add openapi-customer.json openapi-partners.json openapi.json openapi-mcp.json reference/api/
123137
git commit -m "🤖 Auto-update API documentation and OpenAPI spec [skip ci]
124138
125-
- Updated openapi.json with endpoints from 'API Reference - Partners'
139+
- Updated openapi.json with full Customer API spec (for API Reference tab)
140+
- Updated openapi-mcp.json with filtered endpoints from 'API Reference - Partners' (for MCP)
126141
- Source: Customer API from https://api-doc.trykintsugi.com/openapi.json
127142
- Source: Partners API from https://api.trykintsugi.com/openapi.json
128-
- Only endpoints explicitly listed in 'API Reference - Partners' are included
129-
- All endpoints have MCP enabled for /mcp route
143+
- MCP spec includes only endpoints explicitly listed in 'API Reference - Partners'
144+
- All MCP endpoints have MCP enabled for /mcp route
130145
- Regenerated API reference documentation
131146
- Generated on: $(date)"
132147
git push

scripts/create-merged-openapi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ def main():
184184
print("✅ MCP configuration added to all endpoints")
185185

186186
# Step 9: Save merged spec
187-
output_file = 'openapi.json'
187+
# Allow override via environment variable for workflow flexibility
188+
output_file = os.environ.get('OUTPUT_FILE', 'openapi.json')
188189
print(f"💾 Saving OpenAPI spec to {output_file}...")
189190
with open(output_file, 'w') as f:
190191
json.dump(merged_spec, f, indent=2)

0 commit comments

Comments
 (0)