44 push :
55 branches :
66 - " **"
7- workflow_dispatch : # allow manual trigger
7+ workflow_dispatch :
88
99jobs :
1010 gemini-report :
@@ -28,19 +28,19 @@ jobs:
2828 env :
2929 GEMINI_API_KEY : ${{ secrets.GEMINI_API_KEY }}
3030 run : |
31- node <<'EOF '
32- (async () => {
33- const { GoogleGenerativeAI } = await import("@google/generative-ai");
34- const simpleGit = (await import("simple-git")).default;
35- const fs = await import("fs");
31+ node <<'NODEJS '
32+ (async () => {
33+ const { GoogleGenerativeAI } = await import("@google/generative-ai");
34+ const simpleGit = (await import("simple-git")).default;
35+ const fs = await import("fs");
3636
37- const git = simpleGit();
38- const diff = await git.diff(["HEAD~1"]);
37+ const git = simpleGit();
38+ const diff = await git.diff(["HEAD~1"]);
3939
40- const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
41- const model = genAI.getGenerativeModel({ model : " gemini-2.5-flash" });
40+ const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
41+ const model = genAI.getGenerativeModel({ model: "gemini-2.5-flash" });
4242
43- const prompt = `You are a code review expert. Analyze the following git diff and provide a detailed code review.
43+ const prompt = `You are a code review expert. Analyze the following git diff and provide a detailed code review.
4444
4545Focus on :
4646- Potential bugs or logical errors in the NEW code
@@ -62,105 +62,106 @@ Git Diff:
6262${diff}
6363\`\`\``;
6464
65- const result = await model.generateContent(prompt);
66- const report = result.response.text();
65+ const result = await model.generateContent(prompt);
66+ const report = result.response.text();
6767
68- const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
69- const reportName = `report-${timestamp}.html`;
70- const date = new Date();
68+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
69+ const reportName = `report-${timestamp}.html`;
70+ const date = new Date();
7171
72- const html = `<!DOCTYPE html>
72+ // Full styled HTML
73+ const html = `<!DOCTYPE html>
7374<html lang="en">
7475<head>
75- <meta charset="UTF-8">
76- <meta name="viewport" content="width=device-width, initial-scale=1.0">
77- <title>Gemini Code Review</title>
78- <style>
79- * { margin: 0; padding: 0; box-sizing: border-box; }
80- body { font-family : -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: # 333; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 2rem 1rem; }
81- .container { max-width : 900px; margin: 0 auto; background: white; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow: hidden; }
82- .header { background : linear-gradient(135deg, # 667eea 0%, #764ba2 100%); color: white; padding: 3rem 2rem; text-align: center; }
83- .header h1 { font-size : 2.5rem; margin-bottom: 0.5rem; font-weight: 700; }
84- .header p { font-size : 1.1rem; opacity: 0.95; }
85- .timestamp { font-size : 0.9rem; opacity: 0.85; margin-top: 1rem; }
86- .content { padding : 3rem 2rem; }
87- .content h2 { color : # 667eea; margin-top: 2rem; margin-bottom: 1rem; font-size: 1.8rem; border-left: 4px solid #667eea; padding-left: 1rem; }
88- .content h3 { color : # 764ba2; margin-top: 1.5rem; margin-bottom: 0.8rem; font-size: 1.3rem; }
89- .content p { margin-bottom : 1rem; }
90- .content ul, .content ol { margin-left : 2rem; margin-bottom: 1rem; }
91- .content code { background : # f5f5f5; padding: 0.2rem 0.5rem; border-radius: 4px; font-family: monospace; color: #e83e8c; }
92- .content pre { background : # 2d2d2d; color: #f8f8f2; padding: 1.5rem; border-radius: 8px; overflow-x: auto; margin: 1rem 0; font-family: monospace; font-size: 0.9rem; }
93- .content pre code { background : none; padding: 0; color: inherit; }
94- .footer { background : # f9f9f9; padding: 2rem; text-align: center; color: #666; border-top: 1px solid #eee; }
95- .footer a { color : # 667eea; text-decoration: none; }
96- @media (max-width: 768px) { .header h1 { font-size: 1.8rem; } }
97- </style>
76+ <meta charset="UTF-8">
77+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
78+ <title>Gemini Code Review</title>
79+ <style>
80+ * { margin: 0; padding: 0; box-sizing: border-box; }
81+ body { font-family : -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: # 333; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 2rem 1rem; }
82+ .container { max-width : 900px; margin: 0 auto; background: white; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow: hidden; }
83+ .header { background : linear-gradient(135deg, # 667eea 0%, #764ba2 100%); color: white; padding: 3rem 2rem; text-align: center; }
84+ .header h1 { font-size : 2.5rem; margin-bottom: 0.5rem; font-weight: 700; }
85+ .header p { font-size : 1.1rem; opacity: 0.95; }
86+ .timestamp { font-size : 0.9rem; opacity: 0.85; margin-top: 1rem; }
87+ .content { padding : 3rem 2rem; }
88+ .content h2 { color : # 667eea; margin-top: 2rem; margin-bottom: 1rem; font-size: 1.8rem; border-left: 4px solid #667eea; padding-left: 1rem; }
89+ .content h3 { color : # 764ba2; margin-top: 1.5rem; margin-bottom: 0.8rem; font-size: 1.3rem; }
90+ .content p { margin-bottom : 1rem; }
91+ .content ul, .content ol { margin-left : 2rem; margin-bottom: 1rem; }
92+ .content code { background : # f5f5f5; padding: 0.2rem 0.5rem; border-radius: 4px; font-family: monospace; color: #e83e8c; }
93+ .content pre { background : # 2d2d2d; color: #f8f8f2; padding: 1.5rem; border-radius: 8px; overflow-x: auto; margin: 1rem 0; font-family: monospace; font-size: 0.9rem; }
94+ .content pre code { background : none; padding: 0; color: inherit; }
95+ .footer { background : # f9f9f9; padding: 2rem; text-align: center; color: #666; border-top: 1px solid #eee; }
96+ .footer a { color : # 667eea; text-decoration: none; }
97+ @media (max-width: 768px) { .header h1 { font-size: 1.8rem; } }
98+ </style>
9899</head>
99100<body>
100- <div class="container">
101- <div class="header">
102- <h1>🔍 Gemini Code Review</h1>
103- <p>Automated code analysis and recommendations</p>
104- <p class="timestamp">${date.toUTCString()}</p>
105- </div>
106- <div class="content">
107- ${report}
108- </div>
109- <div class="footer">
110- <p>Generated by Gemini Code Analysis | <a href="index.html">← Back to Reports</a></p>
111- </div>
112- </div>
101+ <div class="container">
102+ <div class="header">
103+ <h1>🔍 Gemini Code Review</h1>
104+ <p>Automated code analysis and recommendations</p>
105+ <p class="timestamp">${date.toUTCString()}</p>
106+ </div>
107+ <div class="content">
108+ ${report}
109+ </div>
110+ <div class="footer">
111+ <p>Generated by Gemini Code Analysis | <a href="index.html">← Back to Reports</a></p>
112+ </div>
113+ </div>
113114</body>
114115</html>`;
115116
116- fs.writeFileSync(reportName, html);
117+ fs.writeFileSync(reportName, html);
117118
118- let index = "";
119- if (fs.existsSync("report.html")) {
120- index = fs.readFileSync("report.html", "utf8");
121- } else {
122- index = `<!DOCTYPE html>
119+ let index = "";
120+ if (fs.existsSync("report.html")) {
121+ index = fs.readFileSync("report.html", "utf8");
122+ } else {
123+ index = `<!DOCTYPE html>
123124<html lang="en">
124125<head>
125- <meta charset="UTF-8">
126- <meta name="viewport" content="width=device-width, initial-scale=1.0">
127- <title>Gemini Code Reports</title>
128- <style>
129- * { margin: 0; padding: 0; box-sizing: border-box; }
130- body { font-family : -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, # 667eea 0%, #764ba2 100%); min-height: 100vh; padding: 2rem 1rem; }
131- .container { max-width : 900px; margin: 0 auto; }
132- .header { text-align : center; color: white; margin-bottom: 3rem; }
133- .header h1 { font-size : 3rem; margin-bottom: 0.5rem; font-weight: 700; }
134- .header p { font-size : 1.2rem; opacity: 0.95; }
135- .reports-grid { display : grid; gap: 1.5rem; margin-top: 2rem; }
136- .report-card { background : white; border-radius: 12px; padding: 1.5rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); transition: transform 0.3s ease, box-shadow 0.3s ease; text-decoration: none; color: inherit; display: block; }
137- .report-card:hover { transform : translateY(-5px); box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3); }
138- .report-card h2 { color : # 667eea; margin-bottom: 0.5rem; font-size: 1.3rem; }
139- .report-card .date { color : # 999; font-size: 0.9rem; }
140- @media (max-width: 768px) { .header h1 { font-size: 2rem; } }
141- </style>
126+ <meta charset="UTF-8">
127+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
128+ <title>Gemini Code Reports</title>
129+ <style>
130+ * { margin: 0; padding: 0; box-sizing: border-box; }
131+ body { font-family : -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, # 667eea 0%, #764ba2 100%); min-height: 100vh; padding: 2rem 1rem; }
132+ .container { max-width : 900px; margin: 0 auto; }
133+ .header { text-align : center; color: white; margin-bottom: 3rem; }
134+ .header h1 { font-size : 3rem; margin-bottom: 0.5rem; font-weight: 700; }
135+ .header p { font-size : 1.2rem; opacity: 0.95; }
136+ .reports-grid { display : grid; gap: 1.5rem; margin-top: 2rem; }
137+ .report-card { background : white; border-radius: 12px; padding: 1.5rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); transition: transform 0.3s ease, box-shadow 0.3s ease; text-decoration: none; color: inherit; display: block; }
138+ .report-card:hover { transform : translateY(-5px); box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3); }
139+ .report-card h2 { color : # 667eea; margin-bottom: 0.5rem; font-size: 1.3rem; }
140+ .report-card .date { color : # 999; font-size: 0.9rem; }
141+ @media (max-width: 768px) { .header h1 { font-size: 2rem; } }
142+ </style>
142143</head>
143144<body>
144- <div class="container">
145- <div class="header">
146- <h1>📊 Gemini Code Reviews</h1>
147- <p>Continuous code analysis and insights</p>
148- </div>
149- <div class="reports-grid" id="reports"></div>
150- </div>
145+ <div class="container">
146+ <div class="header">
147+ <h1>📊 Gemini Code Reviews</h1>
148+ <p>Continuous code analysis and insights</p>
149+ </div>
150+ <div class="reports-grid" id="reports"></div>
151+ </div>
151152</body>
152153</html>`;
153- }
154+ }
154155
155- const button = `<a href="./${reportName}" class="report-card"><h2>📝 Code Review Report</h2><p class="date">${date.toUTCString()}</p></a>`;
156- index = index.replace('<div class="reports-grid" id="reports">', `<div class="reports-grid" id="reports">\n${button}`);
156+ const button = `<a href="./${reportName}" class="report-card"><h2>📝 Code Review Report</h2><p class="date">${date.toUTCString()}</p></a>`;
157+ index = index.replace('<div class="reports-grid" id="reports">', `<div class="reports-grid" id="reports">\n${button}`);
157158
158- fs.writeFileSync("report.html", index);
159+ fs.writeFileSync("report.html", index);
159160
160- console.log("=== Gemini Code Review Complete ===");
161- console.log(report);
162- })();
163- EOF
161+ console.log("=== Gemini Code Review Complete ===");
162+ console.log(report);
163+ })();
164+ NODEJS
164165
165166 - name : Commit and push reports
166167 env :
0 commit comments