Skip to content

Commit 1f31b08

Browse files
Merge pull request #805 from codeflash-ai/update-docs
Update the docs for pr optimizations
2 parents a307d81 + e6514e7 commit 1f31b08

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

docs/optimizing-with-codeflash/codeflash-github-actions.mdx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ icon: "github"
55
---
66

77

8-
Optimizing new code in Pull Requests is the best way to ensure that all code you and your team ship is performant
9-
in the future. Automating optimization in the Pull Request stage how most teams use Codeflash, to
8+
Optimizing new code in Pull Requests is the best way to ensure that all code you and your team ship is always performant.
9+
Automating optimization in the Pull Request stage is how most teams use Codeflash, to
1010
continuously find optimizations for their new code.
1111

1212
To scan new code for performance optimizations, Codeflash uses a GitHub Action workflow which runs
1313
the Codeflash optimization logic on the new code in every pull request.
1414
If the action workflow finds an optimization, it communicates with the Codeflash GitHub
1515
App and asks it to suggest new changes to the pull request.
1616

17-
This is the most useful way of using Codeflash, where you set it up once and all your new code gets optimized.
18-
So setting this up is highly recommended.
17+
We highly recommend setting this up, since once you set it up all your new code gets optimized.
1918

2019
## Pull Request Optimization 30 seconds demo
2120
<iframe width="640" height="400" src="https://www.youtube.com/embed/nqa-uewizkU?si=H1wb1RvPp-JqvKPh" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
@@ -68,8 +67,15 @@ name: Codeflash
6867

6968
on:
7069
pull_request:
70+
paths:
71+
- '**' # Modify this to the path of your project in a mono-repo. Codeflash will only run when code in this directory is modified.
7172
workflow_dispatch:
7273

74+
concurrency:
75+
# Any new push to the PR will cancel the previous run, so that only the latest code is optimized
76+
group: ${{ github.workflow }}-${{ github.ref }}
77+
cancel-in-progress: true
78+
7379
jobs:
7480
optimize:
7581
name: Optimize new code in this PR
@@ -103,11 +109,17 @@ jobs:
103109
<Warning>
104110
**Replace the TODOs** in the workflow file above with your project's specific setup commands.
105111
</Warning>
112+
Set the `working-directory` parameter in the yaml file, if the commands are meant to be run from some other directory.
106113
</Step>
107114

108115
<Step title="Choose Your Package Manager">
109116
Customize the dependency installation based on your Python package manager:
110117

118+
The workflow will need to be set up in such a way the Codeflash can create and
119+
run tests for functionality and speed, so the stock YAML may need to be altered to
120+
suit the specific codebase. Typically the setup steps for a unit test workflow can
121+
be copied.
122+
111123
<CodeGroup>
112124
```yaml Poetry
113125
- name: Install Project Dependencies

0 commit comments

Comments
 (0)