Skip to content

Auto: Improve documentation #14

Auto: Improve documentation

Auto: Improve documentation #14

Workflow file for this run

# ============================================================================
# Improve Documentation (AI-driven)
# ============================================================================
# Runs daily (or on demand). Pulls the GDevelop repo, reads what has already
# been improved in automated_updates_data.json, and uses an AI agent to
# improve a DIFFERENT aspect of the documentation each run.
#
# 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: Improve documentation"
on:
schedule:
- cron: "0 10 * * *" # Every day at 10:00 UTC (offset from the other workflow)
workflow_dispatch: # Manual trigger
# pull_request: # For testing in PRs
permissions:
contents: write
pull-requests: write
jobs:
improve-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 improvement script ────────────────────────────────────
- name: Improve documentation
id: improve
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/improve-docs.js
# Pass the AI summary 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
# 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] [Improve] Documentation improvement" >> "$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.improve.outputs.pr_title }}
title: ${{ steps.improve.outputs.pr_title }}
body: |
This PR was automatically generated by the **Improve documentation** workflow.
An AI coding agent inspected the [GDevelop](https://github.com/4ian/GDevelop) codebase
and the existing documentation, then chose an aspect to improve.
The AI agent summary is:
> ${{ steps.improve.outputs.summary }}
The updated `automated_updates_data.json` tracks what was improved so future
runs will pick a different area.
**Please review the changes carefully before merging.**
base: main
branch: auto/improve-docs-${{ steps.suffix.outputs.value }}
delete-branch: true
labels: automated,improvement