Skip to content

Commit

Permalink
Fix version script to exclude merge commits and order logs correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-edmondson committed Jan 3, 2025
1 parent 64e11b6 commit 3a769dc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/make-version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,20 @@ $EXCLUDE_BUILD_FILES = ":(icase,exclude)*/Directory.Build.*"
$EXCLUDE_CI_FILES = ":(icase,exclude).github/workflows/*"
$EXCLUDE_PS_FILES = ":(icase,exclude)*/*.ps1"

$EXCLUDE_PRS = @'
^.*(Merge pull request|Merge branch 'main'|Updated packages in|Update.*package version).*$
'@

$INCLUDE_ALL_FILES = "*/*.*"

$FIRST_COMMIT = (git rev-list HEAD)[-1]
$LAST_COMMIT = $github_sha

$COMMITS = "$FIRST_COMMIT...$LAST_COMMIT"

$LAST_PATCH_COMMIT = git log -n 1 --perl-regexp --regexp-ignore-case --format=format:%H --committer="$EXCLUDE_BOTS" --author="$EXCLUDE_BOTS" $COMMITS
$LAST_PATCH_COMMIT = git log -n 1 --topo-order --perl-regexp --regexp-ignore-case --format=format:%H --committer="$EXCLUDE_BOTS" --author="$EXCLUDE_BOTS" --grep="$EXCLUDE_PRS" --invert-grep $COMMITS

$LAST_MINOR_COMMIT = git log -n 1 --perl-regexp --regexp-ignore-case --format=format:%H --committer="$EXCLUDE_BOTS" --author="$EXCLUDE_BOTS" $COMMITS `
$LAST_MINOR_COMMIT = git log -n 1 --topo-order --perl-regexp --regexp-ignore-case --format=format:%H --committer="$EXCLUDE_BOTS" --author="$EXCLUDE_BOTS" --grep="$EXCLUDE_PRS" --invert-grep $COMMITS `
-- `
$INCLUDE_ALL_FILES `
$EXCLUDE_HIDDEN_FILES `
Expand Down Expand Up @@ -121,4 +125,4 @@ Write-Host "VERSION: $VERSION"
# output files
$VERSION | Out-File -FilePath VERSION.md -Encoding utf8

$global:LASTEXITCODE = 0
$global:LASTEXITCODE = 0

0 comments on commit 3a769dc

Please sign in to comment.