perf(core): Add batch loading for collection product variants #1755
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: Generate Docs | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| - minor | |
| - major | |
| paths: | |
| - 'packages/**/*.ts' | |
| - 'packages/**/*.tsx' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| generate: | |
| name: Generate & commit docs | |
| # Skip fork PRs — can't push back to fork branches | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| models: read | |
| steps: | |
| - name: Generate CI Bot Token | |
| id: app-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ secrets.CI_BOT_APP_ID }} | |
| private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }} | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| ref: ${{ github.head_ref }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install root dependencies | |
| run: npm install | |
| - name: Generate TypeScript docs | |
| run: npm run docs:generate-typescript-docs | |
| - name: Generate GraphQL docs | |
| run: npm run docs:generate-graphql-docs | |
| - name: Install docs dependencies | |
| working-directory: docs | |
| run: npm install | |
| - name: Validate generated docs | |
| working-directory: docs | |
| run: npm run test:mdx | |
| - name: Check for changes | |
| id: diff | |
| run: | | |
| git add docs/ | |
| if git diff --cached --quiet; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| # Capture a stat summary + truncated diff for the AI commit message | |
| { | |
| echo 'summary<<DIFF_EOF' | |
| git diff --cached --stat | |
| echo '---' | |
| git diff --cached -- '*.mdx' | head -200 | |
| echo 'DIFF_EOF' | |
| } >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Generate commit message | |
| if: steps.diff.outputs.changed == 'true' | |
| id: ai-message | |
| continue-on-error: true | |
| uses: actions/ai-inference@v1 | |
| with: | |
| model: openai/gpt-4o-mini | |
| max-tokens: 100 | |
| system-prompt: | | |
| You generate concise git commit messages in conventional commit format. | |
| Always use the type "docs" with no scope. Write only the commit message | |
| subject line, nothing else. No quotes, no backticks, no explanation. | |
| Keep it under 72 characters. Describe what specifically changed in the | |
| documentation based on the diff provided. | |
| prompt: | | |
| Generate a commit message for these auto-generated documentation changes: | |
| ${{ steps.diff.outputs.summary }} | |
| - name: Get CI Bot user info | |
| if: steps.diff.outputs.changed == 'true' | |
| id: get-user | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| user_id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}%5Bbot%5D" --jq .id) | |
| echo "user-id=$user_id" >> "$GITHUB_OUTPUT" | |
| - name: Commit and push generated docs | |
| if: steps.diff.outputs.changed == 'true' | |
| env: | |
| AI_MESSAGE: ${{ steps.ai-message.outputs.response }} | |
| run: | | |
| git config user.name "${{ steps.app-token.outputs.app-slug }}[bot]" | |
| git config user.email "${{ steps.get-user.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com" | |
| message="${AI_MESSAGE:-docs: Generate docs for source changes}" | |
| git commit -m "$message" | |
| git push |