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