Devin CI Fix #31
This file contains hidden or 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
| name: Devin CI Fix | |
| on: | |
| workflow_run: | |
| workflows: ["Java CI"] | |
| types: [completed] | |
| jobs: | |
| trigger-devin: | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event.workflow_run.conclusion == 'failure' && | |
| github.event.workflow_run.head_branch != 'master' && | |
| !startsWith(github.event.workflow_run.head_branch, 'devin/') | |
| steps: | |
| - name: Call Devin API | |
| env: | |
| REPO_NAME: ${{ github.event.repository.full_name }} | |
| BRANCH_NAME: ${{ github.event.workflow_run.head_branch }} | |
| DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }} | |
| run: | | |
| PROMPT="A CI build failed in the ${REPO_NAME} repository on the ${BRANCH_NAME} branch. Your task is to fix the build. | |
| - Pull the latest from the ${REPO_NAME} repository | |
| - Checkout the ${BRANCH_NAME} branch | |
| - Run the build locally to reproduce the failure | |
| - Identify and fix the cause of the build failure | |
| - Push your changes to the ${BRANCH_NAME} branch | |
| The CI will automatically run again to verify your fix." | |
| PAYLOAD=$(jq -n \ | |
| --arg prompt "$PROMPT" \ | |
| --arg title "Fix CI - ${BRANCH_NAME}" \ | |
| '{prompt: $prompt, title: $title, idempotent: true}') | |
| curl -X POST https://api.devin.ai/v1/sessions \ | |
| -H "Authorization: Bearer ${DEVIN_API_KEY}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" |