Skip to content

Commit

Permalink
🎨 Format prepare_changelog script
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Dec 11, 2024
1 parent 5b42fbd commit a4596b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/prepare_changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const REPO_URL = 'https://github.com/SpyglassMC/Spyglass'

async function main() {
const repoRoot = path.join(__dirname, '..')
const gitLog = await execFile('git', ['log', "--pretty=format:%H %an %s"], { cwd: repoRoot })
const gitLog = await execFile('git', ['log', "--pretty=format:%H %an %s"], { cwd: repoRoot })
const commits = gitLog.stdout.split('\n')
.map(line => {
const [hash, author, ...messageParts] = line.split(' ')
Expand All @@ -22,11 +22,11 @@ async function main() {
const newFeatures: string[] = []
const bugFixes: string[] = []
for (const c of changelogCommits) {
const hash = `[\`${c.hash.slice(0, 7)}\`](${REPO_URL}/commit/${c.hash})`
const hash = `[\`${c.hash.slice(0, 7)}\`](${REPO_URL}/commit/${c.hash})`
const match = c.message.match(/ \((#[0-9]+)\)$/)
const pr = match ? ` ([${match[1]}](${REPO_URL}/pull/${match[1].slice(1)}))` : ''
let message = match ? c.message.slice(0, c.message.length - match[0].length) : c.message
message = message.replace(/^[:\w]*:?\s?/, '').replace(/^[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}🐛]+\s?/u, '') // Uhhh ChatGPT did this
let message = match ? c.message.slice(0, c.message.length - match[0].length) : c.message
message = message.replace(/^[:\w]*:?\s?/, '').replace(/^[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}🐛]+\s?/u, '') // Uhhh ChatGPT did this
if (c.message.startsWith(':sparkles:') || c.message.startsWith('✨')) {
newFeatures.push(`- ${hash} ${message}${pr}`)
} else if (c.message.startsWith(':bug:') || c.message.startsWith('🐛')) {
Expand Down

0 comments on commit a4596b9

Please sign in to comment.