繁體中文
了解如何在 GitHub Actions 和其他持續整合系統中使用 Cursor CLI
- name: 安裝 Cursor CLI run: | curl https://cursor.com/install -fsS | bash echo "$HOME/.cursor/bin" >> $GITHUB_PATH - name: 執行 Cursor Agent env: CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }} run: | cursor-agent -p "Your prompt here" --model gpt-5
- name: Update docs (full autonomy) run: | cursor-agent -p "You have full access to git, GitHub CLI, and PR operations. Handle the entire docs update workflow including commits, pushes, and PR comments."
- name: Generate docs updates (restricted) run: | cursor-agent -p "IMPORTANT: Do NOT create branches, commit, push, or post PR comments. Only modify files in the working directory. A later workflow step handles publishing." - name: Publish docs branch (deterministic) run: | # Deterministic git operations handled by CI git checkout -B "docs/${{ github.head_ref }}" git add -A git commit -m "docs: update for PR" git push origin "docs/${{ github.head_ref }}" - name: Post PR comment (deterministic) run: | # Deterministic PR commenting handled by CI gh pr comment ${{ github.event.pull_request.number }} --body "Docs updated"
{ "permissions": { "allow": [ "Read(**/*.md)", "Write(docs/**/*)", "Shell(grep)", "Shell(find)" ], "deny": [ "Shell(git)", "Shell(gh)", "Write(.env*)", "Write(package.json)" ] } }
CURSOR_API_KEY
env: CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}
這個頁面有幫助嗎?