Skip to content

Automate browser based workflows with AI

Codeflash GHA ⚡ (#1928)

Kevin Turcios9e474ade7b1a
diff --git a/.github/workflows/codeflash.yaml b/.github/workflows/codeflash.yaml
new file mode 100644
index 000000000..557e27c56
--- /dev/null
+++ b/.github/workflows/codeflash.yaml
@@ -0,0 +1,43 @@
+name: Codeflash
+
+on:
+ pull_request:
+ paths:
+ # So that this workflow only runs when code within the target module is modified
+ - "skyvern/**"
+ workflow_dispatch:
+
+concurrency:
+ # Any new push to the PR will cancel the previous run, so that only the latest code is optimized
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ optimize:
+ name: Optimize new Python code in this PR
+ # Don't run codeflash on codeflash-ai[bot] commits, prevent duplicate optimizations
+ if: ${{ github.actor != 'codeflash-ai[bot]' }}
+ runs-on: ubuntu-latest
+ env:
+ CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
+ CODEFLASH_PR_NUMBER: ${{ github.event.number }}
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.11"
+ - name: Install Project Dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install poetry
+ poetry install --all-extras
+ poetry add codeflash
+
+ - name: Run Codeflash to optimize code
+ run: |
+ poetry env use python
+ poetry run codeflash
diff --git a/pyproject.toml b/pyproject.toml
index 8f0961d29..7985961d4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -135,3 +135,11 @@ plugins = "sqlalchemy.ext.mypy.plugin"
[tool.poetry.scripts]
skyvern = "skyvern.cli.commands:app"
+
+[tool.codeflash]
+# All paths are relative to this pyproject.toml's directory.
+module-root = "skyvern"
+tests-root = "tests"
+test-framework = "pytest"
+ignore-paths = ["skyvern/client"]
+formatter-cmds = ["ruff check --exit-zero --fix $file", "ruff format $file"]
\ No newline at end of file