ci: 当仅 version.json 的 last_updated 有变动时,回退对应服务器所有资源文件改动 (#10453)

This commit is contained in:
AnnAngela
2024-09-04 17:21:42 +08:00
committed by GitHub
parent fa557cfc10
commit 01ba8904e2
2 changed files with 83 additions and 43 deletions

View File

@@ -178,51 +178,14 @@ jobs:
with:
args: -w ${{ steps.task_sorting.outputs.gitdiff }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
- name: Check if only sorted and Templates
id: check_sorted_templates
run: |
git status
$gitdiff = git diff --numstat HEAD 2>$null | findstr -i resource
if ($LASTEXITCODE -ne 0) {
Write-Output "no diff"
exit 0
}
Write-Output $gitdiff
$diff = $false
$hasPng = $false
$diffLines = $gitdiff -split "`n"
foreach ($line in $diffLines) {
$parts = $line -split "\s+"
$filePath = $parts[2]
$firstNumber = $parts[0]
$secondNumber = $parts[1]
if ($filePath -match "\.png$") {
$hasPng = $true
}
if ($firstNumber -gt 1 -or $firstNumber -ne $secondNumber) {
$diff = $true
}
if ($hasPng -and $diff) {
break
}
}
$changes = $hasPng -or $diff
Write-Output "diff: $diff"
Write-Output "hasPng: $hasPng"
Write-Output "changes: $changes"
Write-Output "contains_png=$hasPng" >> $env:GITHUB_OUTPUT
Write-Output "changes=$changes" >> $env:GITHUB_OUTPUT
run: node tools/ResourceUpdateValidator/index.mjs
- name: Setup python
if: steps.check_sorted_templates.outputs.contains_png == 'True'