Perbarui dokumentasi repository secara otomatis menggunakan Cursor CLI di GitHub Actions
name: Auto Update Docs
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: write
pull-requests: write
jobs:
auto-docs:
if: ${{ !startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Cursor CLI
run: |
curl https://cursor.com/install -fsS | bash
echo "$HOME/.cursor/bin" >> $GITHUB_PATH
- name: Configure git
run: |
git config user.name "Cursor Agent"
git config user.email "cursoragent@cursor.com"
- name: Update docs
env:
MODEL: gpt-5
CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_PREFIX: docs
run: |
cursor-agent -p "Kamu sedang beroperasi di dalam GitHub Actions runner.
GitHub CLI tersedia sebagai `gh` dan sudah terotentikasi melalui `GH_TOKEN`. Git tersedia. Kamu punya akses write ke konten repository dan bisa comment di pull request, tapi kamu nggak boleh bikin atau edit PR.
# Konteks:
- Repo: ${{ github.repository }}
- Owner: ${{ github.repository_owner }}
- PR Number: ${{ github.event.pull_request.number }}
- Base Ref: ${{ github.base_ref }}
- Head Ref: ${{ github.head_ref }}
- Docs Branch Prefix: ${{ env.BRANCH_PREFIX }}
# Tujuan:
- Implementasikan flow update docs end-to-end yang dijalankan berdasarkan perubahan incremental di PR asli.
# Requirements:
1) Tentukan apa yang berubah di PR asli dan, kalau ada beberapa push, hitung diff incremental sejak update docs terakhir yang berhasil.
2) Update cuma docs yang relevan berdasarkan perubahan incremental tersebut.
3) Maintain branch docs persisten untuk PR head ini pakai Docs Branch Prefix dari Konteks. Bikin kalau belum ada, update kalau sudah ada, dan push perubahan ke origin.
4) Kamu NGGAK punya permission untuk bikin PR. Sebagai gantinya, post atau update satu comment PR natural language (1–2 kalimat) yang jelasin singkat update docs dan include inline compare link untuk quick-create PR
# Input dan konvensi:
- Pakai `gh pr diff` dan git history untuk detect perubahan dan derive range incremental sejak update docs terakhir.
- Jangan coba bikin atau edit PR langsung. Pakai format compare link di atas.
- Keep perubahan tetap minimal dan konsisten dengan style repo. Kalau nggak ada update doc yang perlu, jangan bikin perubahan dan jangan post comment.
# Deliverable ketika update terjadi:
- Commit yang di-push ke branch docs persisten untuk PR head ini.
- Satu comment PR natural language di PR asli yang include inline compare link di atas. Hindari posting duplikat; update comment bot sebelumnya kalau ada.
" --force --model "$MODEL" --output-format=text
Apakah halaman ini membantu?