From 851550b58955a9daf7213624d5ce50368c029eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8B=AE=E5=AD=90=E8=80=97=E8=80=97?= <3116737282@qq.com> Date: Sun, 27 Apr 2025 10:54:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=E5=BC=80=E5=8F=91=E5=88=86?= =?UTF-8?q?=E6=94=AF=E5=90=8E=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=B0=86=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E9=93=BE=E6=8E=A5=E6=B7=BB=E5=8A=A0=E5=88=B0=E6=8B=89?= =?UTF-8?q?=E5=8F=96=E8=AF=B7=E6=B1=82=E4=B8=8B?= 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 4766c83..ff336eb 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 @@ -67,8 +68,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-reference \ No newline at end of file + command: pages deploy ./src/.vuepress/dist --project-name=jingji-reference + + - 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