Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
contents: read
pages: write
id-token: write
pull-requests: write

steps:
- name: Checkout
Expand Down Expand Up @@ -50,3 +51,20 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Comment PR with preview URL
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request.number;
const url = process.env.PREVIEW_URL;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr,
body: `Preview this PR: ${url}`
});
env:
PREVIEW_URL: ${{ steps.deployment.outputs.page_url }}

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
## 🚀 部署说明

本项目采用 GitHub Actions 自动化部署到 GitHub Pages,每次推送到主分支时自动构建和部署。
在每个 Pull Request 上也会自动构建预览,并在 PR 评论中提供访问链接。

如需 fork 此项目进行自定义开发:

Expand Down
Loading