From 18f99870e3aa04c061a51347077fa597b586d7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B5=A9?= <3116737282@qq.com> Date: Sun, 27 Apr 2025 10:38:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E9=83=A8=E7=BD=B2=E5=90=8E=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=B0=86=E9=A2=84=E8=A7=88=E9=93=BE=E6=8E=A5=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=88=B0=E6=8B=89=E5=8F=96=E8=AF=B7=E6=B1=82=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/dev.yaml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/dev.yaml b/.gitea/workflows/dev.yaml index 17f2fa6..b3c6fdf 100644 --- a/.gitea/workflows/dev.yaml +++ b/.gitea/workflows/dev.yaml @@ -42,6 +42,7 @@ jobs: permissions: contents: read deployments: write + pull-requests: write steps: - name: 🚚 Checkout uses: actions/checkout@v4 @@ -66,8 +67,26 @@ jobs: run: pnpm run docs:build - name: 🚀 Deploy to Cloudflare Pages + id: deploy uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy ./src/.vuepress/dist --project-name=jingji-spbook \ No newline at end of file + command: pages deploy ./src/.vuepress/dist --project-name=jingji-spbook + + - name: 💬 Comment on PR + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + const deployUrl = process.env.DEPLOY_URL; + const commentBody = `🚀 Documentation preview deployed to: [${deployUrl}](${deployUrl})`; + + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: commentBody + }); + env: + DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }} \ No newline at end of file