Skip to content

Commit

Permalink
refactor: use cpe to make commits at the end of pr comment workflow job
Browse files Browse the repository at this point in the history
  • Loading branch information
spachava753 committed Jan 27, 2025
1 parent b37ffa4 commit 3544e2b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/pr-comment-cpe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ jobs:
if: ${{ github.event.issue.pull_request && github.event.issue.state == 'open' }}
runs-on: ubuntu-latest
permissions: write-all
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
CPE_CLAUDE_3_5_SONNET_URL: ${{ secrets.CPE_CLAUDE_3_5_SONNET_URL }}
steps:
# First checkout the default branch
- uses: actions/checkout@v3

- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Get PR information
id: pr_info
env:
Expand Down Expand Up @@ -55,9 +63,6 @@ jobs:
cpe-cache-${{ steps.pr_info.outputs.head_ref }}
- name: Run CPE
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
CPE_CLAUDE_3_5_SONNET_URL: ${{ secrets.CPE_CLAUDE_3_5_SONNET_URL }}
run: |
# Check if .cpeconvo file exists and set the continue flag accordingly
if [ -f ".cpeconvo" ]; then
Expand All @@ -70,13 +75,12 @@ jobs:
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Check if there are any changes to commit
if [[ -n "$(git status --porcelain)" ]]; then
git add .
git commit -m "CPE: Process comment on PR #${{ github.event.issue.number }}"
# Ask CPE to commit the changes
echo "Please commit the changes with a suitable commit message" | cpe -continue
# Push the changes
git push origin HEAD:${{ steps.pr_info.outputs.head_ref }}
else
echo "No changes to commit"
Expand Down

0 comments on commit 3544e2b

Please sign in to comment.