ci: use changelogen utility to get current branch

This commit is contained in:
Daniel Roe 2023-09-04 09:44:23 +01:00
parent d28189eb58
commit 7431e22588

View File

@ -1,15 +1,13 @@
import { execSync } from 'node:child_process' import { execSync } from 'node:child_process'
import { $fetch } from 'ofetch' import { $fetch } from 'ofetch'
import { inc } from 'semver' import { inc } from 'semver'
import { generateMarkDown, loadChangelogConfig } from 'changelogen' import { generateMarkDown, getCurrentGitBranch, loadChangelogConfig } from 'changelogen'
import { determineBumpType, getLatestCommits, loadWorkspace } from './_utils' import { determineBumpType, getLatestCommits, loadWorkspace } from './_utils'
const releaseBranch = process.env.GITHUB_REF_NAME || 'main'
async function main () { async function main () {
const releaseBranch = await getCurrentGitBranch()
const workspace = await loadWorkspace(process.cwd()) const workspace = await loadWorkspace(process.cwd())
const config = await loadChangelogConfig(process.cwd(), { const config = await loadChangelogConfig(process.cwd(), {})
})
const commits = await getLatestCommits().then(commits => commits.filter( const commits = await getLatestCommits().then(commits => commits.filter(
c => config.types[c.type] && !(c.type === 'chore' && c.scope === 'deps' && !c.isBreaking) c => config.types[c.type] && !(c.type === 'chore' && c.scope === 'deps' && !c.isBreaking)