瀏覽代碼

fix: 排除 workflow 文件的自动提交以避免权限问题

在格式化代码提交时排除 .github/ 目录,避免触发以下错误:
"refusing to allow a GitHub App to create or update workflow without workflows permission"

修改内容:
- 在 git add -A 后添加 git restore --staged .github/
- 只提交源代码的格式化,不提交 workflow 文件

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
ding113 3 月之前
父節點
當前提交
19ca5e4882
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      .github/workflows/dev.yml

+ 3 - 0
.github/workflows/dev.yml

@@ -52,6 +52,9 @@ jobs:
           # 添加所有更改(格式化后的代码)
           git add -A
 
+          # 排除 .github/ 目录的更改(workflow 文件不需要自动提交,且需要特殊权限)
+          git restore --staged .github/ 2>/dev/null || true
+
           # 检查是否有更改需要提交
           if git diff --cached --quiet; then
             echo "No changes to commit"