CI improvement: not using the REST API to get PR message

Fix #15091, close #15125
This commit is contained in:
ArkadiuszMichalski 2024-05-11 10:49:11 +02:00 committed by Don Ho
parent 8055b5687b
commit 88193a73f3
1 changed files with 1 additions and 8 deletions

View File

@ -37,14 +37,7 @@ jobs:
$isPush = "${{github.event_name }}" -eq "push" ? $true : $false
$isMaster = $isPush -and $${{ github.ref_name == github.event.repository.master_branch }}
if ($isPush) {
$commit_message = (git show -s --format=%B)
}
else {
$last_commit = @(Invoke-RestMethod ${{ github.event.pull_request._links.commits.href }})[0] | Select-Object -Last 1
$commit_message = $last_commit.commit.message
}
$commit_message = $isPush ? (git show -s --format=%B) : (git log -1 --no-merges --pretty=%B)
$commit_title = ($commit_message -split "[\r\n]+")[0]
Write-Output "title=$commit_title" >> $env:GITHUB_OUTPUT
$files_modified = @(git diff --name-only HEAD~1)