ArkadiuszMichalski 8 months ago committed by Don Ho
parent 045d21aa15
commit 35f601b665

@ -20,6 +20,7 @@ jobs:
run: | run: |
$allowMaster = $true $allowMaster = $true
$folders_onejob = "PowerEditor/(Test|(installer/(filesForTesting|functionList)))/" $folders_onejob = "PowerEditor/(Test|(installer/(filesForTesting|functionList)))/"
$folders_nowork = "\.github/ISSUE_TEMPLATE"
$files_nowork = "md|txt|log|ini" $files_nowork = "md|txt|log|ini"
$files_needwork = "CMakeLists\.txt" $files_needwork = "CMakeLists\.txt"
@ -34,13 +35,13 @@ jobs:
$commit_message = (git show -s --format=%B) $commit_message = (git show -s --format=%B)
} }
else { else {
$last_commit = @(Invoke-RestMethod ${{ github.event.pull_request._links.commits.href }})[0] | Select-Object -Last 1 $last_commit = @(Invoke-RestMethod ${{ github.event.pull_request._links.commits.href }})[0] | Select-Object -Last 1
$commit_message = $last_commit.commit.message $commit_message = $last_commit.commit.message
} }
$commit_title = ($commit_message -split "[\r\n]+")[0] $commit_title = ($commit_message -split "[\r\n]+")[0]
$files_modified = @(git diff --name-only HEAD~1) $files_modified = @(git diff --name-only HEAD~1)
$files_needwork_all = @($files_modified | Where-Object {$_ -notmatch "\.(xml|$files_nowork)$|$folders_onejob" -or $_ -match "$files_needwork$"}) $files_needwork_all = @($files_modified | Where-Object {$_ -notmatch "\.(xml|$files_nowork)$|$folders_nowork|$folders_onejob" -or $_ -match "($files_needwork)$"})
if ($allowMaster -or !$isMaster) { if ($allowMaster -or !$isMaster) {
if ($commit_title -match "\[force all\]") { if ($commit_title -match "\[force all\]") {
@ -52,7 +53,7 @@ jobs:
Write-Output $matrix_onejob >> $env:GITHUB_OUTPUT Write-Output $matrix_onejob >> $env:GITHUB_OUTPUT
} }
elseif (($files_modified.length -gt 0 -and $files_needwork_all.length -eq 0) -or $commit_title -match "\[force (xml|none)\]") { elseif (($files_modified.length -gt 0 -and $files_needwork_all.length -eq 0) -or $commit_title -match "\[force (xml|none)\]") {
if (@($files_modified | Where-Object {$_ -notmatch "\.($files_nowork)$"}).length -eq 0 -or $commit_title -match "\[force none\]") { if (@($files_modified | Where-Object {$_ -notmatch "\.($files_nowork)$|$folders_nowork"}).length -eq 0 -or $commit_title -match "\[force none\]") {
Write-Output "Changed files on this commit don't require any additional tasks.`n" Write-Output "Changed files on this commit don't require any additional tasks.`n"
Write-Output "result=OK" >> $env:GITHUB_OUTPUT Write-Output "result=OK" >> $env:GITHUB_OUTPUT
} }

Loading…
Cancel
Save