Give commands an authenticated API client, per-workspace auth sessions, telemetry, and real prompts — the foundations for porting the platform CLI onto the engine #314
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: Preview CLI Package | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| concurrency: | |
| group: preview-cli-package-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| preview: | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| persist-credentials: false | |
| - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 | |
| with: | |
| cache: true | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version-file: .node-version | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Resolve preview version | |
| id: cli_version | |
| run: | | |
| node scripts/resolve-package-version.mjs pr \ | |
| --package-dir packages/cli \ | |
| --sha '${{ github.event.pull_request.head.sha }}' \ | |
| --pr-number '${{ github.event.pull_request.number }}' >> "$GITHUB_OUTPUT" | |
| # Build every workspace package up front via the turbo graph so | |
| # workspace:* dependencies (the CLI's @prisma/cli-engine) have | |
| # their dist output before the test and build steps below. | |
| - name: Build workspace packages | |
| run: pnpm build | |
| - name: Run focused CLI tests | |
| id: cli_tests | |
| run: pnpm --filter @prisma/cli test | |
| - name: Run compute tests | |
| id: compute_tests | |
| run: pnpm --filter @prisma/compute test | |
| - name: Build CLI package | |
| id: cli_build | |
| run: pnpm --filter @prisma/cli build | |
| - name: Build compute package | |
| id: compute_build | |
| run: pnpm --filter @prisma/compute build | |
| - name: Set preview package version | |
| id: set_preview_version | |
| working-directory: packages/cli | |
| run: pnpm version '${{ steps.cli_version.outputs.version }}' --no-git-tag-version | |
| - name: Publish installable PR preview | |
| id: publish_preview | |
| continue-on-error: ${{ vars.CLI_PR_PREVIEW_REQUIRED != 'true' }} | |
| run: pnpm exec pkg-pr-new publish --bin --comment=update packages/cli | |
| - name: Summarize PR preview publish | |
| if: ${{ always() }} | |
| run: | | |
| { | |
| echo "## Preview CLI Package" | |
| echo | |
| echo "- Version: \`${{ steps.cli_version.outputs.version }}\`" | |
| echo "- CLI tests: \`${{ steps.cli_tests.outcome || 'skipped' }}\`" | |
| echo "- Compute tests: \`${{ steps.compute_tests.outcome || 'skipped' }}\`" | |
| echo "- Build: \`${{ steps.cli_build.outcome || 'skipped' }}\`" | |
| echo "- Compute build: \`${{ steps.compute_build.outcome || 'skipped' }}\`" | |
| echo "- Version injection: \`${{ steps.set_preview_version.outcome || 'skipped' }}\`" | |
| echo "- pkg.pr.new publish: \`${{ steps.publish_preview.outcome || 'skipped' }}\`" | |
| PUBLISH_OUTCOME="${{ steps.publish_preview.outcome || 'skipped' }}" | |
| if [ "${PUBLISH_OUTCOME}" != "success" ]; then | |
| echo | |
| echo "pkg.pr.new publishing is best-effort while \`CLI_PR_PREVIEW_REQUIRED\` is not \`true\`. If this failed, confirm the pkg.pr.new GitHub App is installed for this repository and rerun the workflow." | |
| fi | |
| } >> "$GITHUB_STEP_SUMMARY" |