codeflash-internal/.github/workflows/codeflash-js.yaml
Kevin Turcios eeecdc11d7
Bump stale GitHub Actions versions (#2618)
## Summary

Bumps all stale GitHub Actions to their latest stable versions across 7
workflow files.

### Changes

| Workflow | Action | Old | New |
|---|---|---|---|
| `ci.yaml` | `astral-sh/setup-uv` | `@v8.0.0` / `@v7` (inline jobs
only) | `@v8.1.0` |
| `claude.yml` | `astral-sh/setup-uv` | `@v6` | `@v8.1.0` |
| `codeflash-aiservice.yaml` | `astral-sh/setup-uv` | `@v7` | `@v8.1.0`
|
| `codeflash-js.yaml` | `astral-sh/setup-uv` | `@v7` | `@v8.1.0` |
| `deploy_aiservice_to_azure.yml` | `astral-sh/setup-uv` | `@v7` |
`@v8.1.0` |
| `fix-formatting.yml` | `astral-sh/setup-uv` | `@v5` | `@v8.1.0` |
| `fix-formatting.yml` | `j178/prek-action` | `@v1` | `@v2` |
| `publish-to-pypi.yml` | `pypa/gh-action-pypi-publish` | `@master` |
`@release/v1` |

### Notes

- Shared workflow refs (`codeflash-ai/github-workflows/...@main`) in
`ci.yaml` are **not** changed -- those follow `@main` and will pick up
updates from the shared workflows repo.
- `publish-to-pypi.yml` is currently disabled (`if: false`) but the ref
is fixed anyway to avoid issues when re-enabled.

## Test plan

- [ ] CI passes on this PR (the workflow files themselves are the
change, so CI validates they parse correctly)
- [ ] Verify `ci.yaml` shared workflow `uses:` lines still reference
`@main`
2026-04-23 05:49:17 -05:00

169 lines
4.5 KiB
YAML

name: Codeflash JS/TS Optimization
on:
pull_request:
paths:
- "js/cf-api/**"
- "js/cf-webapp/**"
workflow_dispatch:
inputs:
project:
description: "Project to optimize (cf-api, cf-webapp, or both)"
required: false
default: "both"
type: choice
options:
- both
- cf-api
- cf-webapp
permissions:
contents: read
packages: read
pull-requests: read
checks: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Check which projects have changes
check-changes:
runs-on: ubuntu-latest
outputs:
cf-api: ${{ steps.filter.outputs.cf-api }}
cf-webapp: ${{ steps.filter.outputs.cf-webapp }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
cf-api:
- 'js/cf-api/**'
cf-webapp:
- 'js/cf-webapp/**'
# Skip job when no JS changes detected (only for pull_request events)
no-js-changes:
name: No JS/TS changes detected
needs: check-changes
if: |
github.event_name == 'pull_request'
&& needs.check-changes.outputs.cf-api != 'true'
&& needs.check-changes.outputs.cf-webapp != 'true'
runs-on: ubuntu-latest
steps:
- name: Skip optimization
run: echo "Skipping codeflash optimization - no changes in js/cf-api/ or js/cf-webapp/"
# Optimize cf-api (Jest)
optimize-cf-api:
needs: [check-changes]
if: |
(
needs.check-changes.outputs.cf-api == 'true'
|| github.event_name == 'workflow_dispatch' && (github.event.inputs.project == 'cf-api' || github.event.inputs.project == 'both')
)
&& github.actor != 'codeflash-ai[bot]'
name: Optimize cf-api
runs-on: ubuntu-latest
env:
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
CODEFLASH_PR_NUMBER: ${{ github.event.number }}
COLUMNS: 110
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up 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 cf-api dependencies
working-directory: js
run: pnpm install --frozen-lockfile
- name: Set up Python and install Codeflash
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: "3.12"
- name: Install Codeflash CLI
run: |
uv tool install git+https://github.com/codeflash-ai/codeflash@main
- name: Run Codeflash optimization
working-directory: js/cf-api
run: |
export PATH="$HOME/.local/bin:$PATH"
codeflash --yes
# Optimize cf-webapp (Vitest)
optimize-cf-webapp:
needs: [check-changes]
if: |
(
needs.check-changes.outputs.cf-webapp == 'true'
|| github.event_name == 'workflow_dispatch' && (github.event.inputs.project == 'cf-webapp' || github.event.inputs.project == 'both')
)
&& github.actor != 'codeflash-ai[bot]'
name: Optimize cf-webapp
runs-on: ubuntu-latest
env:
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
CODEFLASH_PR_NUMBER: ${{ github.event.number }}
COLUMNS: 110
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up 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 cf-webapp dependencies
working-directory: js
run: pnpm install --frozen-lockfile
- name: Set up Python and install Codeflash
uses: astral-sh/setup-uv@v8.1.0
with:
python-version: "3.12"
- name: Install Codeflash CLI
run: |
uv tool install git+https://github.com/codeflash-ai/codeflash@main
- name: Run Codeflash optimization
working-directory: js/cf-webapp
run: |
export PATH="$HOME/.local/bin:$PATH"
codeflash --yes