部署开发分支后,自动将预览链接添加到拉取请求下
This commit is contained in:
parent
c301c0a014
commit
e5b8968313
@ -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
|
||||
|
||||
- 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 }}
|
Loading…
x
Reference in New Issue
Block a user