test(core): add unit tests for customer-group promotion condition #1369
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@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2 | |
| with: | |
| app-id: ${{ secrets.CI_BOT_APP_ID }} | |
| private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }} | |
| # Least privilege: token is only used to commit & push regenerated docs to the PR branch. | |
| permission-contents: write | |
| - name: Checkout PR branch | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| ref: ${{ github.head_ref }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: '22' | |
| - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: '1.3.10' | |
| - name: Install root dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Generate TypeScript docs | |
| run: bun run docs:generate-typescript-docs | |
| - name: Generate GraphQL docs | |
| run: bun 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@b81b2afb8390ee6839b494a404766bef6493c7d9 # v1.2.8 | |
| 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 |