@@ -15,31 +15,69 @@ jobs:
1515 runs-on : ubuntu-latest
1616 permissions :
1717 contents : write
18- pull-requests : write
1918
2019 steps :
2120 - name : Checkout code
2221 uses : actions/checkout@v4
2322
24- - name : Generate site with Claude
25- uses : anthropics/claude-code-action@v1
26- with :
27- claude_api_key : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
28- github_token : ${{ secrets.GITHUB_TOKEN }}
29- prompt : |
30- You are a web developer creating a GitHub Pages site for a Spotify MCP server.
23+ - name : Read site prompt
24+ id : prompt
25+ run : |
26+ echo "content<<EOF" >> $GITHUB_OUTPUT
27+ cat docs/site-prompt.md >> $GITHUB_OUTPUT
28+ echo "EOF" >> $GITHUB_OUTPUT
3129
32- Please read the following files:
33- - docs/site-prompt.md (contains all design requirements and specifications)
34- - README.md (for project context)
35- - src/spotify_mcp/fastmcp_server.py (to extract tool information)
30+ - name : Generate site with Claude API
31+ env :
32+ ANTHROPIC_API_KEY : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
33+ run : |
34+ # Build the prompt
35+ cat > request.json <<'JSONEOF'
36+ {
37+ "model": "claude-sonnet-4-20250514",
38+ "max_tokens": 8192,
39+ "messages": [
40+ {
41+ "role": "user",
42+ "content": "You are a web developer creating a GitHub Pages site.\n\nHere are the requirements:\n\n${{ steps.prompt.outputs.content }}\n\nPlease generate a complete, production-ready index.html file. Output ONLY the HTML code, no explanations or markdown code blocks."
43+ }
44+ ]
45+ }
46+ JSONEOF
3647
37- Then regenerate docs/index.html following all requirements in site-prompt.md.
48+ # Call Claude API
49+ RESPONSE=$(curl -s https://api.anthropic.com/v1/messages \
50+ -H "content-type: application/json" \
51+ -H "x-api-key: $ANTHROPIC_API_KEY" \
52+ -H "anthropic-version: 2023-06-01" \
53+ -d @request.json)
3854
39- Make sure the site:
40- - Uses Spotify's black/dark theme with green accents
41- - Lists all 13 MCP tools with accurate descriptions
42- - Is mobile-friendly and responsive
43- - Includes proper attribution
55+ # Extract HTML and save
56+ echo "$RESPONSE" | jq -r '.content[0].text' > docs/index.html.new
4457
45- After generating, commit the updated docs/index.html file.
58+ # Verify file has content
59+ if [ ! -s docs/index.html.new ]; then
60+ echo "❌ Error: Generated HTML is empty"
61+ echo "$RESPONSE" | jq '.'
62+ exit 1
63+ fi
64+
65+ mv docs/index.html.new docs/index.html
66+ echo "✅ Generated docs/index.html ($(wc -l < docs/index.html) lines)"
67+
68+ - name : Commit and push if changed
69+ run : |
70+ git config user.name 'github-actions[bot]'
71+ git config user.email 'github-actions[bot]@users.noreply.github.com'
72+
73+ git add docs/index.html
74+
75+ if git diff --staged --quiet; then
76+ echo "No changes to commit"
77+ else
78+ git commit -m "Regenerate GitHub Pages site
79+
80+ Generated by Claude API from docs/site-prompt.md"
81+ git push
82+ echo "✅ Pushed updated site"
83+ fi
0 commit comments