From 2cdb0445ccdcd2ec8596f0003d3b184162b95aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=BC=A0=E4=B9=8B=E5=AD=90?= <7850715+maboloshi@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:42:10 +0800 Subject: [PATCH] =?UTF-8?q?GA=EF=BC=9A=E4=BF=AE=E6=AD=A3=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E7=89=88=E8=AF=8D=E5=BA=93`locals.js`=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=97=A5=E6=9C=9F=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.user.js_version_update.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.user.js_version_update.yaml b/.github/workflows/main.user.js_version_update.yaml index b48c29a0d..fc6cd0e3a 100644 --- a/.github/workflows/main.user.js_version_update.yaml +++ b/.github/workflows/main.user.js_version_update.yaml @@ -48,8 +48,12 @@ jobs: if: | ${{ env.LOCALS_JS_IS_CHANGED == 'true' }} run: | + # 获取最后一次提交中`locals.js`的文件时间 + locals_js_time=$(git log -1 --format=%at -- locals.js) + # 使用`locals.js`的文件日期为词库版本号 - locals_js_date=$(TZ='Asia/Shanghai' date -d "$(stat -c %y locals.js)" +'%Y-%m-%d') + locals_js_date=$(TZ='Asia/Shanghai' date -d "@$locals_js_time" +'%Y-%m-%d') + sed -i -E "s/(@version\s*[0-9]+\.[0-9]+\.[0-9]+)(-[0-9]{4}-[0-9]{2}-[0-9]{2})?/\ \1-$locals_js_date/" main.user.js git diff --quiet --exit-code main.user.js || \