部署开发分支后,自动将预览链接添加到拉取请求下
This commit is contained in:
parent
c301c0a014
commit
e5b8968313
@ -42,6 +42,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
deployments: write
|
deployments: write
|
||||||
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: 🚚 Checkout
|
- name: 🚚 Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -67,8 +68,26 @@ jobs:
|
|||||||
run: pnpm run docs:build
|
run: pnpm run docs:build
|
||||||
|
|
||||||
- name: 🚀 Deploy to Cloudflare Pages
|
- name: 🚀 Deploy to Cloudflare Pages
|
||||||
|
id: deploy
|
||||||
uses: cloudflare/wrangler-action@v3
|
uses: cloudflare/wrangler-action@v3
|
||||||
with:
|
with:
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
command: pages deploy ./src/.vuepress/dist --project-name=jingji-reference
|
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