mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-25 14:58:14 -05:00
fix(releases): improve commit categorization and ci security (#2992)
* fix(releases): improve commit categorization and CI security * fix(releases): remove redundant update check
This commit is contained in:
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@@ -27,10 +27,11 @@ jobs:
|
||||
steps:
|
||||
- name: Extract version from commit message
|
||||
id: extract
|
||||
env:
|
||||
COMMIT_MSG: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
COMMIT_MSG="${{ github.event.head_commit.message }}"
|
||||
# Only tag versions on main branch
|
||||
if [ "${{ github.ref }}" = "refs/heads/main" ] && [[ "$COMMIT_MSG" =~ ^(v[0-9]+\.[0-9]+\.[0-9]+): ]]; then
|
||||
if [ "$GITHUB_REF" = "refs/heads/main" ] && [[ "$COMMIT_MSG" =~ ^(v[0-9]+\.[0-9]+\.[0-9]+): ]]; then
|
||||
VERSION="${BASH_REMATCH[1]}"
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "is_release=true" >> $GITHUB_OUTPUT
|
||||
|
||||
@@ -126,7 +126,7 @@ async function fetchGitHubCommitDetails(
|
||||
|
||||
const githubUsername = commit.author?.login || commit.committer?.login || 'unknown'
|
||||
|
||||
let cleanMessage = commit.commit.message.split('\n')[0] // First line only
|
||||
let cleanMessage = commit.commit.message.split('\n')[0]
|
||||
if (prNumber) {
|
||||
cleanMessage = cleanMessage.replace(/\s*\(#\d+\)\s*$/, '')
|
||||
}
|
||||
@@ -226,12 +226,23 @@ async function getCommitsBetweenVersions(
|
||||
function categorizeCommit(message: string): 'features' | 'fixes' | 'improvements' | 'other' {
|
||||
const msgLower = message.toLowerCase()
|
||||
|
||||
if (
|
||||
msgLower.includes('feat') ||
|
||||
msgLower.includes('add') ||
|
||||
msgLower.includes('implement') ||
|
||||
msgLower.includes('new ')
|
||||
) {
|
||||
if (/^feat(\(|:|!)/.test(msgLower)) {
|
||||
return 'features'
|
||||
}
|
||||
|
||||
if (/^fix(\(|:|!)/.test(msgLower)) {
|
||||
return 'fixes'
|
||||
}
|
||||
|
||||
if (/^(improvement|improve|perf|refactor)(\(|:|!)/.test(msgLower)) {
|
||||
return 'improvements'
|
||||
}
|
||||
|
||||
if (/^(chore|docs|style|test|ci|build)(\(|:|!)/.test(msgLower)) {
|
||||
return 'other'
|
||||
}
|
||||
|
||||
if (msgLower.includes('feat') || msgLower.includes('implement') || msgLower.includes('new ')) {
|
||||
return 'features'
|
||||
}
|
||||
|
||||
@@ -242,9 +253,10 @@ function categorizeCommit(message: string): 'features' | 'fixes' | 'improvements
|
||||
if (
|
||||
msgLower.includes('improve') ||
|
||||
msgLower.includes('enhance') ||
|
||||
msgLower.includes('update') ||
|
||||
msgLower.includes('upgrade') ||
|
||||
msgLower.includes('optimization')
|
||||
msgLower.includes('optimization') ||
|
||||
msgLower.includes('add') ||
|
||||
msgLower.includes('update')
|
||||
) {
|
||||
return 'improvements'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user