# This is an example workflow for generating documentation using OnPush in a CI environment. 
# It can be triggered manually via the GitHub Actions interface.

name: Generate Documentation

on:
  workflow_dispatch:

jobs:
  generate-docs:
    runs-on: ubuntu-latest

    permissions:
      contents: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '24'

      - name: Install Claude Code
        run: npm install -g @anthropic-ai/claude-code

      - name: Install onpush
        run: npm install -g onpush

      - name: Generate documentation
        run: onpush generate --ci
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

      # After generating documentation, you might want to commit and push the changes back to the repository
      # or upload them as artifacts. Below is an example of how to commit and push the generated documentation.

      # - name: Commit and push documentation
      #   run: |
      #     git config user.name "onpush-docs-action"
      #     git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
      #     git add docs/
      #     if git diff --cached --quiet; then
      #       echo "No documentation changes to commit"
      #     else
      #       git commit -m "docs: update generated documentation"
      #       git push
      #     fi
      #   env:
      #     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
