Skip to content

Commit a2dd342

Browse files
Update GitHub Actions workflow permissions and checkout
Added permissions to resolve GITHUB_TOKEN write access issues and modified checkout step to fetch full repository history.
1 parent 2884c7d commit a2dd342

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
14+
# 仅新增:声明工作流权限,解决GITHUB_TOKEN无写入权限的核心问题
15+
permissions:
16+
contents: write
1417
steps:
1518
- name: Install pnpm
1619
uses: pnpm/action-setup@v2
@@ -28,6 +31,9 @@ jobs:
2831
# 1. 拉取代码
2932
- name: Checkout code
3033
uses: actions/checkout@v4
34+
# 仅新增:拉取完整仓库历史,避免推送分支时的历史缺失问题
35+
with:
36+
fetch-depth: 0
3137

3238
# 2. 安装 Node.js(Astro 要求 Node.js 18+)
3339
- name: Setup Node.js
@@ -52,8 +58,3 @@ jobs:
5258
publish_dir: ./dist # 要推送的目录(Astro 构建产物)
5359
publish_branch: page # 目标分支(page 分支)
5460
force_orphan: true # 强制创建孤儿分支(只保留 dist 内容,可选)
55-
56-
57-
58-
59-

0 commit comments

Comments
 (0)