Skip to main content
EVOKORE// WORKFLOWS / docs.changelog-to-docs.yml
ComposioHQ/composioworkflow · 92 lines

workflows/docs.changelog-to-docs.yml

CI / automation

View on GitHub →
# REFERENCE-ONLY: GitHub Actions secrets referenced below are illustrative.
# Do not inject real credentials. See your CI/CD provider for proper secret management.
name: Changelog → Docs PR

on:
  push:
    branches: [next]
    paths:
      - 'docs/content/changelog/**.mdx'

jobs:
  suggest-docs-updates:
    name: Suggest Documentation Updates
    runs-on: ubuntu-latest
    timeout-minutes: 30
    permissions:
      contents: write
      pull-requests: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Detect new changelog files
        id: detect
        run: |
          BEFORE="${{ github.event.before }}"
          AFTER="${{ github.event.after }}"

          if [[ "$BEFORE" =~ ^0+$ ]]; then
            FILES=$(git diff --name-only --diff-filter=AM HEAD^..HEAD | grep '^docs/content/changelog/.*\.mdx$' || echo "")
          else
            FILES=$(git diff --name-only --diff-filter=AM "$BEFORE".."$AFTER" | grep '^docs/content/changelog/.*\.mdx$' || echo "")
          fi

          if [ -z "$FILES" ]; then
            echo "found=false" >> $GITHUB_OUTPUT
          else
            echo "found=true" >> $GITHUB_OUTPUT
            echo "files<<EOF" >> $GITHUB_OUTPUT
            echo "$FILES" >> $GITHUB_OUTPUT
            echo "EOF" >> $GITHUB_OUTPUT
          fi

      - name: Codex updates docs
        if: steps.detect.outputs.found == 'true'
        uses: openai/codex-action@v1
        with:
          openai-api-key: ${{ secrets.OPENAI_API_KEY }}
          sandbox: workspace-write
          prompt: |
            New changelog entries were merged to next. Read the agent instructions and update documentation accordingly.

            1. Read docs/.claude/agents/changelog-docs-updater.md for full instructions
            2. Read each of these changelog files:
            ${{ steps.detect.outputs.files }}
            3. For each change, search docs/content/docs/ for pages that need updating
            4. Make the documentation updates following the agent instructions
            5. If no docs changes are needed, make no file changes and explain why

      - name: Create PR if docs changed
        if: steps.detect.outputs.found == 'true'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          if [ -z "$(git status --porcelain)" ]; then
            echo "No documentation changes needed"
            exit 0
          fi

          BRANCH="docs/changelog-update-${GITHUB_SHA::7}"
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git checkout -b "$BRANCH"
          git add -A
          git commit -m "docs: update documentation for new changelog entries"
          git push -u origin "$BRANCH"

          gh pr create \
            --base next \
            --head "$BRANCH" \
            --title "docs: update documentation for new changelog entries" \
            --body "$(cat <<'EOF'
          ## Summary
          Automated documentation updates triggered by new changelog entries merged to next.

          Generated by Codex via GitHub Actions.
          EOF
          )"