name: CF-API CI permissions: contents: read pull-requests: read on: pull_request: paths: - 'js/cf-api/**' workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: # This job checks if the workflow should run based on file changes check-changes: runs-on: ubuntu-latest outputs: should-run: ${{ steps.filter.outputs.cfapi }} steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - uses: dorny/paths-filter@v4 id: filter with: filters: | cfapi: - 'js/cf-api/**' # This job always runs and succeeds, allowing PRs to be merged when paths don't match skip-validate: needs: check-changes if: needs.check-changes.outputs.should-run != 'true' runs-on: ubuntu-latest steps: - name: Skip validation run: echo "Skipping CF-API validation - no changes in js/cf-api/" validate: needs: check-changes if: needs.check-changes.outputs.should-run == 'true' env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest permissions: contents: read packages: read steps: - name: Checkout repository uses: actions/checkout@v6 - name: Setup Node.js uses: actions/setup-node@v6 with: node-version: '20' registry-url: https://npm.pkg.github.com scope: '@codeflash-ai' - name: Install pnpm uses: pnpm/action-setup@v4 with: version: 10 - name: Install dependencies working-directory: js run: pnpm install --frozen-lockfile - name: Build common package working-directory: js run: pnpm --filter @codeflash-ai/common build - name: Run tests working-directory: js/cf-api run: NODE_OPTIONS=--experimental-vm-modules pnpm jest --ci --config jest.config.cjs - name: Build working-directory: js/cf-api run: pnpm build # - name: Type check # run: | # cd js/cf-api # npx tsc --noEmit # # - name: Lint # run: | # cd js/cf-api # npx eslint . --ext .ts,.mjs