From 670e0615452338393e225a9f2d2c3020a6659a22 Mon Sep 17 00:00:00 2001 From: szhhwh <3116737282@qq.com> Date: Sat, 26 Apr 2025 21:16:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=E6=A3=80=E6=9F=A5=E6=AD=A5=E9=AA=A4=E4=BB=A5=E5=86=B3?= =?UTF-8?q?=E5=AE=9A=E6=98=AF=E5=90=A6=E6=89=A7=E8=A1=8C=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=92=8C=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/dev.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.gitea/workflows/dev.yaml b/.gitea/workflows/dev.yaml index 0c7f4dd..190d4b3 100644 --- a/.gitea/workflows/dev.yaml +++ b/.gitea/workflows/dev.yaml @@ -6,7 +6,38 @@ on: types: [opened,synchronize] jobs: + check-file-changes: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.filter.outputs.should_run }} + steps: + - name: 🚚 Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 📑 Check changed files + id: filter + run: | + CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} || git diff --name-only HEAD~1 HEAD) + + MD_ONLY=true + for file in $CHANGED_FILES; do + if [[ ! $file =~ \.md$ ]]; then + MD_ONLY=false + break + fi + done + + if [ "$MD_ONLY" = false ] || [ -z "$CHANGED_FILES" ]; then + echo "should_run=true" >> $GITHUB_OUTPUT + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi + build-and-deploy: + needs: check-file-changes + if: ${{ needs.check-file-changes.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest permissions: contents: read