fix: 按提交标题触发滚动开发版构建(#199)
This commit is contained in:
3 files changed
+17
-3
No files matched your search
@@ -45,8 +45,15 @@ jobs:
|
||||
PREVIOUS_SHA: ${{ github.event.before }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
$publish = $true
|
||||
if ($env:PREVIOUS_SHA -notmatch '^0+$') {
|
||||
# Read the commit object so shallow checkouts retain its parent headers.
|
||||
$commitLines = @(git cat-file commit HEAD)
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Could not read the main commit' }
|
||||
$headerEnd = [Array]::IndexOf($commitLines, '')
|
||||
if ($headerEnd -lt 1) { throw 'Could not locate the main commit message' }
|
||||
$parents = @($commitLines[0..($headerEnd - 1)] -like 'parent *')
|
||||
$subject = $commitLines[$headerEnd + 1]
|
||||
$publish = $parents.Count -le 1 -and $subject -like '*#*' -and $subject -notlike '*docs*'
|
||||
if ($publish -and $env:PREVIOUS_SHA -notmatch '^0+$') {
|
||||
git fetch --depth=1 origin $env:PREVIOUS_SHA
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Could not fetch the previous main commit' }
|
||||
$changed = git diff --name-only $env:PREVIOUS_SHA HEAD -- . ':(exclude)docs/**' ':(exclude)README.md' ':(exclude,glob)README.*.md' ':(exclude)AGENTS.md' ':(exclude).github/ISSUE_TEMPLATE/**' ':(exclude).github/PULL_REQUEST_TEMPLATE.md' ':(exclude).github/readme/**'
|
||||
|
||||
Reference in new issue
Block a user