Auto: Update docs from GDevelop commits #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================ | |
| # Update Documentation from GDevelop Commits | |
| # ============================================================================ | |
| # Runs daily (or on demand). Pulls the GDevelop repo, inspects recent commits | |
| # since the last tracked commit, and uses an AI agent (Claude Code by default, | |
| # Codex as an alternative) to update the docs accordingly. | |
| # | |
| # To switch from Claude Code to Codex: | |
| # 1. Change AI_PROVIDER to "codex" | |
| # 2. Comment out the "Install Claude Code" step and uncomment "Install Codex" | |
| # 3. Swap the API key secrets (comment ANTHROPIC_API_KEY, uncomment OPENAI_API_KEY) | |
| # ============================================================================ | |
| name: "Auto: Update docs from GDevelop commits" | |
| on: | |
| schedule: | |
| - cron: "0 8 * * *" # Every day at 08:00 UTC | |
| workflow_dispatch: # Manual trigger | |
| # pull_request: # For testing in PRs | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-docs: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'GDevelopApp/GDevelop-documentation' | |
| timeout-minutes: 20 | |
| steps: | |
| # ── Checkout this documentation repo ────────────────────────────── | |
| - name: Checkout documentation repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # ── Node.js ─────────────────────────────────────────────────────── | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| # ── Install AI CLI ──────────────────────────────────────────────── | |
| - name: Install Claude Code | |
| run: npm install -g @anthropic-ai/claude-code | |
| # Uncomment below (and comment above) to use Codex instead: | |
| # - name: Install Codex | |
| # run: npm install -g @openai/codex | |
| # ── Generate a random suffix for the branch name ───────────────── | |
| - name: Generate branch suffix | |
| id: suffix | |
| run: echo "value=$(openssl rand -hex 2)" >> "$GITHUB_OUTPUT" | |
| # ── Run the update script ───────────────────────────────────────── | |
| - name: Update documentation from recent commits | |
| id: update | |
| env: | |
| AI_PROVIDER: "claude" # Change to "codex" to use Codex | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| node scripts/update-docs-from-commits.js | |
| # Pass the AI summary and commit log to subsequent steps | |
| if [ -f /tmp/ai_summary.txt ]; then | |
| delimiter="EOF_$(openssl rand -hex 8)" | |
| { | |
| echo "summary<<${delimiter}" | |
| cat /tmp/ai_summary.txt | |
| echo "" | |
| echo "${delimiter}" | |
| } >> "$GITHUB_OUTPUT" | |
| fi | |
| if [ -f /tmp/commit_log.txt ]; then | |
| delimiter="EOF_$(openssl rand -hex 8)" | |
| { | |
| echo "commits<<${delimiter}" | |
| cat /tmp/commit_log.txt | |
| echo "" | |
| echo "${delimiter}" | |
| } >> "$GITHUB_OUTPUT" | |
| fi | |
| # Pass the AI-generated PR title to subsequent steps | |
| if [ -f /tmp/ai_pr_title.txt ]; then | |
| delimiter="EOF_$(openssl rand -hex 8)" | |
| { | |
| echo "pr_title<<${delimiter}" | |
| cat /tmp/ai_pr_title.txt | |
| echo "" | |
| echo "${delimiter}" | |
| } >> "$GITHUB_OUTPUT" | |
| else | |
| echo "pr_title=[Auto] [Update] Documentation update from commits" >> "$GITHUB_OUTPUT" | |
| fi | |
| # ── Create Pull Request ─────────────────────────────────────────── | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: ${{ steps.update.outputs.pr_title }} | |
| title: ${{ steps.update.outputs.pr_title }} | |
| body: | | |
| This PR was automatically generated by the **Update docs from GDevelop commits** workflow. | |
| An AI coding agent analysed recent commits in [4ian/GDevelop](https://github.com/4ian/GDevelop) | |
| and updated the documentation to reflect user-facing changes. | |
| ### GDevelop commits covered | |
| ``` | |
| ${{ steps.update.outputs.commits }} | |
| ``` | |
| ### The AI agent summary is: | |
| ${{ steps.update.outputs.summary }} | |
| **Please review the changes carefully before merging.** | |
| base: main | |
| branch: auto/update-docs-from-commits-${{ steps.suffix.outputs.value }} | |
| delete-branch: true | |
| labels: automated,update |