Adding TYPEOF Support, plus moving wiki to main repo #1
Workflow file for this run
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
| name: Auto Documentation | |
| on: | |
| pull_request: | |
| branches: [main] | |
| types: [opened, ready_for_review, reopened, synchronize] | |
| paths: | |
| - "source/**" | |
| - "plugins/**" | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| auto-documentation: | |
| name: Generate Documentation | |
| if: ${{ !github.event.pull_request.draft }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout PR Branch | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| ref: ${{ github.head_ref }} | |
| fetch-depth: 0 | |
| - name: Check if last commit was auto-documentation | |
| id: check-auto-commit | |
| run: | | |
| LAST_COMMIT_MSG=$(git log -1 --pretty=format:"%s") | |
| if [[ "$LAST_COMMIT_MSG" == *"Auto-generate documentation"* ]]; then | |
| echo "auto-commit=true" >> "$GITHUB_OUTPUT" | |
| echo "Last commit was auto-documentation - skipping to prevent loops" | |
| else | |
| echo "auto-commit=false" >> "$GITHUB_OUTPUT" | |
| echo "Last commit was not auto-documentation - analyzing code for documentation updates" | |
| fi | |
| - name: Get Changed Apex Files | |
| if: steps.check-auto-commit.outputs.auto-commit == 'false' | |
| id: changed-files | |
| run: | | |
| # Get list of changed .cls files in source and plugins directories | |
| git diff --name-only origin/main..HEAD | grep -E '\.(cls|trigger)$' > changed_files.txt || touch changed_files.txt | |
| if [ -s changed_files.txt ]; then | |
| echo "has-changes=true" >> "$GITHUB_OUTPUT" | |
| echo "Changed Apex files:" | |
| cat changed_files.txt | |
| else | |
| echo "has-changes=false" >> "$GITHUB_OUTPUT" | |
| echo "No Apex files changed" | |
| fi | |
| - name: Analyze Code Changes with Claude | |
| if: steps.check-auto-commit.outputs.auto-commit == 'false' && steps.changed-files.outputs.has-changes == 'true' | |
| uses: anthropics/claude-code-action@beta | |
| with: | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| direct_prompt: | | |
| I need you to analyze the changed Apex files in this PR and automatically generate/update wiki documentation. | |
| ## Your Task: | |
| 1. **Analyze each changed .cls and .trigger file** to identify new or modified `global` elements: | |
| - New `global` classes (including inner types) | |
| - New `global` methods | |
| - New `global` properties | |
| - Modified signatures of existing global elements | |
| 2. **Generate wiki documentation** for any new global elements: | |
| - Create new wiki files for new global classes following the pattern `The-[ClassName]-Class.md` | |
| - Add new methods to existing class documentation files in the wiki directory | |
| - Add new properties to existing class documentation files in the wiki directory | |
| - Update `wiki/_Sidebar.md` to include new class files in alphabetical order within their appropriate sections | |
| 3. **Follow the existing documentation patterns** in the `wiki/` directory: | |
| - Use the same markdown structure and formatting as existing files | |
| - Include method signatures, parameter descriptions, and return types | |
| - Add code examples where appropriate | |
| - Maintain consistent cross-references between files using relative links | |
| - Follow the existing naming conventions exactly | |
| ## Important Guidelines: | |
| - Only document `global` elements (ignore private/protected/public without global) | |
| - Follow the existing wiki file naming conventions exactly (The-[ClassName]-Class.md) | |
| - Preserve existing content - only add new sections or update existing ones | |
| - If no new global elements are found, create no files | |
| - When updating existing files, insert new content in appropriate sections | |
| - Maintain alphabetical ordering in _Sidebar.md | |
| ## Expected Output: | |
| Create or modify files in the `wiki/` directory as needed. I will review these changes as part of the PR. | |
| - name: Check for Documentation Changes | |
| if: steps.check-auto-commit.outputs.auto-commit == 'false' | |
| id: check-docs | |
| run: | | |
| if git diff --quiet HEAD -- wiki/; then | |
| echo "has-doc-changes=false" >> "$GITHUB_OUTPUT" | |
| echo "No documentation changes generated" | |
| else | |
| echo "has-doc-changes=true" >> "$GITHUB_OUTPUT" | |
| echo "Documentation changes detected:" | |
| git diff --name-only HEAD -- wiki/ | |
| fi | |
| - name: Commit Documentation Updates | |
| if: steps.check-auto-commit.outputs.auto-commit == 'false' && steps.check-docs.outputs.has-doc-changes == 'true' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add wiki/ | |
| git commit -m "Auto-generate documentation for code changes | |
| Updated docs | |
| git push origin ${{ github.head_ref }} |