-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6044d99
commit f0c9229
Showing
3 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Codeflash | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- renovate/** | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
optimize: | ||
name: Optimize new code in this PR | ||
runs-on: ubuntu-latest | ||
env: | ||
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} | ||
CODEFLASH_PR_NUMBER: ${{ github.event.number }} | ||
steps: | ||
- name: Check if PR is from Codeflash bot | ||
id: bot_check | ||
run: |- | ||
echo "Checking if this PR is created by Codeflash bot..." | ||
if [ "${{ github.event.pull_request.user.login }}" == "codeflash-ai[bot]" ]; then | ||
echo "PR created by Codeflash bot. Skipping optimization." | ||
echo "skip_remaining_steps=yes" >> $GITHUB_OUTPUT | ||
else | ||
echo "skip_remaining_steps=no" >> $GITHUB_OUTPUT | ||
echo "It's not. Proceeding with the optimization." | ||
fi | ||
- uses: actions/checkout@v4 | ||
if: steps.bot_check.outputs.skip_remaining_steps == 'no' | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Python | ||
if: steps.bot_check.outputs.skip_remaining_steps == 'no' | ||
uses: actions/setup-python@v5 | ||
with: | ||
cache-dependency-path: pyproject.toml | ||
cache: pip | ||
python-version: 3.12 | ||
|
||
- name: Install Project Dependencies | ||
if: steps.bot_check.outputs.skip_remaining_steps == 'no' | ||
run: >- | ||
python -m pip install -e .; python -m pip install codeflash | ||
- name: Run Codeflash to optimize code | ||
if: steps.bot_check.outputs.skip_remaining_steps == 'no' | ||
id: optimize_code | ||
run: codeflash |
This file contains 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
This file contains 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