Added checks
All checks were successful
Publish Library / Build NPM Project (push) Successful in 4s
Publish Library / Tag Version (push) Successful in 16s
Code review / review (pull_request) Successful in 38s

This commit is contained in:
2026-01-14 15:56:07 -05:00
parent e625782eec
commit 8cfcb3f95c

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env node #!/usr/bin/env node
import {Ai} from '@ztimson/ai'; import {Ai} from '@ztimson/ai';
import * as dotenv from 'dotenv'; import * as dotenv from 'dotenv';
import {$} from '@ztimson/node-utils';
dotenv.config({quiet: true, debug: false}); dotenv.config({quiet: true, debug: false});
dotenv.config({path: '.env.local', override: true, quiet: true, debug: false}); dotenv.config({path: '.env.local', override: true, quiet: true, debug: false});
@@ -32,6 +33,10 @@ dotenv.config({path: '.env.local', override: true, quiet: true, debug: false});
// Get latest tag // Get latest tag
const latestTag = await $`git describe --tags --abbrev=0`.text(); const latestTag = await $`git describe --tags --abbrev=0`.text();
if(!latestTag) {
console.error('At least one Git tag is required');
process.exit(1);
}
// Build context // Build context
let context = `Milestone: ${milestoneData.title} let context = `Milestone: ${milestoneData.title}
@@ -57,7 +62,11 @@ ${issues.filter(i => !i.pull_request).map(i => `- ${i.title}\n${i.body || ''}`).
system: `You are a release notes writer. Format the provided milestone info, PRs, and issues into clean, organized release notes. Use markdown with sections like "Features", "Bug Fixes", "Breaking Changes", etc. Be concise but informative. Include issue/PR numbers in format #123.` system: `You are a release notes writer. Format the provided milestone info, PRs, and issues into clean, organized release notes. Use markdown with sections like "Features", "Bug Fixes", "Breaking Changes", etc. Be concise but informative. Include issue/PR numbers in format #123.`
}); });
const body = (await ai.chat(context)).pop().content; const body = (await ai.chat(context)).pop()?.content;
if(!body) {
console.error('No release notes were generated');
process.exit(1);
}
// Create release // Create release
const name = latestTag.trim(); const name = latestTag.trim();
@@ -72,7 +81,7 @@ ${issues.filter(i => !i.pull_request).map(i => `- ${i.title}\n${i.body || ''}`).
tag_name: name, tag_name: name,
body body
}) })
}).then(resp => resp.ok ? console.log('Release created! 🎉') : console.error('Failed to create release')); }).then(resp => { if(!resp.ok) throw new Error(resp.status + ' ' + resp.statusText) });
console.log(`Title: ${name}\nDescription:\n${body}`); console.log(`Title: ${name}\nDescription:\n${body}`);
})().catch(err => { })().catch(err => {