From ddf0e0d132174481c481b9d7a67b11b5b8661e88 Mon Sep 17 00:00:00 2001 From: neveler <55753029+neveler@users.noreply.github.com> Date: Mon, 3 Nov 2025 20:12:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=85=E5=9C=A8=E7=9B=91=E5=90=AC=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E5=90=AF=E7=94=A8=20ruby=20=E7=BC=93?= =?UTF-8?q?=E5=AD=98=20(#322)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-preview.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 1057ab1..7804909 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -12,7 +12,7 @@ env: JEKYLL_ENV: production jobs: preview-remove: - if: >- + if: ${{ !github.event.repository.fork && ( ( github.event_name == 'pull_request_target' && ( @@ -119,7 +119,7 @@ jobs: name: "preview/watch" }); preview-create-init: - if: >- + if: ${{ !github.event.repository.fork && ( ( github.event_name == 'pull_request_target' && ( @@ -189,6 +189,15 @@ jobs: preview-create-build: needs: preview-create-init runs-on: ubuntu-latest + env: + PREVIEW_WATCH: + ${{ + contains(github.event.pull_request.labels.*.name, 'preview/watch') || + contains(github.event.issue.labels.*.name, 'preview/watch') || ( + github.event_name == 'issue_comment' && + github.event.comment.body == '/preview watch' + ) + }} outputs: artifact-id: ${{ steps.upload-site.outputs.artifact-id }} steps: @@ -207,8 +216,8 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: "3.4" - bundler-cache: true - cache-version: pr${{ env.GITHUB_PR_NUMBER }} + bundler-cache: ${{ env.PREVIEW_WATCH }} + cache-version: PR-${{ env.GITHUB_PR_NUMBER }} - name: Jekyll Build run: | echo "url: https://${{ needs.preview-create-init.outputs.domain }}" > _action.yml @@ -217,6 +226,7 @@ jobs: echo "destination: /home/runner/site" >> _action.yml echo "preview:" >> _action.yml echo " pr-number: ${{ env.GITHUB_PR_NUMBER }}" >> _action.yml + ${{ env.PREVIEW_WATCH }} || bundle install --jobs 4 bundle exec jekyll build --config _config.yml,_action.yml - id: upload-site name: Upload Site