From 55fc9f55256c8e663fa28ce125542e9b6a435fc5 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 01:09:48 +0000 Subject: [PATCH 1/2] Add Devin API GitHub Actions workflows - Add automated code review workflow for pull requests - Add test fixing workflow for manual triggering - Comprehensive documentation for workflow usage - Integration with Devin API Action from DEVIN-GITHUB-ACTIONS repo Co-Authored-By: Sam Fertig --- .github/workflows/README.md | 130 ++++++++++++++++++++++ .github/workflows/devin-code-review.yml | 136 ++++++++++++++++++++++++ .github/workflows/devin-test-fix.yml | 102 ++++++++++++++++++ 3 files changed, 368 insertions(+) create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/devin-code-review.yml create mode 100644 .github/workflows/devin-test-fix.yml diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..636e8b6 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,130 @@ +# GitHub Actions Workflows for Banking Microservices + +This directory contains automated workflows that integrate with Devin API for various development tasks. + +## Available Workflows + +### 1. Automated Code Review with Devin (`devin-code-review.yml`) + +**Trigger**: Automatically runs on pull requests or can be manually triggered + +**Purpose**: Creates a Devin session to review code changes for: +- Code quality and best practices +- Security vulnerabilities (authentication, financial transactions) +- Spring Boot and microservices patterns +- Database interactions and transaction handling +- API endpoint security and validation +- Test coverage and quality + +**Usage**: +- Automatically triggered when PRs are opened or updated +- Can be manually triggered from Actions tab with custom review focus +- Posts a comment on the PR with the Devin session link + +**Required Secrets**: +- `DEVIN_API_KEY`: Your Devin API key from [settings](https://app.devin.ai/settings) + +**Example Manual Trigger**: +1. Go to Actions tab +2. Select "Automated Code Review with Devin" +3. Click "Run workflow" +4. Optionally specify a review focus area + +### 2. Fix Failing Tests with Devin (`devin-test-fix.yml`) + +**Trigger**: Manual workflow dispatch only + +**Purpose**: Creates a Devin session to automatically fix failing tests in specified services + +**Usage**: +1. Go to Actions tab +2. Select "Fix Failing Tests with Devin" +3. Click "Run workflow" +4. Choose which service to fix (or "all" for all services) +5. Optionally provide additional instructions +6. Devin will analyze failures, fix code, and verify the fixes + +**Required Secrets**: +- `DEVIN_API_KEY`: Your Devin API key + +**Services Available**: +- all (runs tests on testable services) +- Service-Registry +- Sequence-Generator +- API-Gateway +- User-Service +- Account-Service +- Fund-Transfer +- Transaction-Service + +## Setup Instructions + +### 1. Get a Devin API Key + +1. Visit [Devin Settings](https://app.devin.ai/settings) +2. Navigate to API Keys section +3. Create a new API key +4. Copy the key (you won't be able to see it again) + +### 2. Add API Key as GitHub Secret + +1. Go to your repository on GitHub +2. Navigate to Settings → Secrets and variables → Actions +3. Click "New repository secret" +4. Name: `DEVIN_API_KEY` +5. Value: Paste your Devin API key +6. Click "Add secret" + +### 3. Enable Workflows + +The workflows are now ready to use! They will: +- Automatically trigger on pull requests (code review) +- Be available for manual triggering from the Actions tab + +## Workflow Outputs + +All workflows provide: +- **Session ID**: Unique identifier for the Devin session +- **Session URL**: Direct link to monitor Devin's progress +- **Session Status**: Information about the session state + +You can monitor Devin's work in real-time by visiting the session URL provided in the workflow output. + +## Customization + +You can customize these workflows by: +- Modifying the `prompt` in the workflow files to change Devin's instructions +- Adding or removing `tags` for better session organization +- Adjusting `max-acu-limit` to control session resource usage +- Adding more workflows for other use cases (e.g., documentation generation, refactoring) + +## Devin Action Documentation + +For complete documentation on the Devin GitHub Action, see: +- [Action Repository](https://github.com/samfert-codeium/DEVIN-GITHUB-ACTIONS) +- [Usage Examples](https://github.com/samfert-codeium/DEVIN-GITHUB-ACTIONS/tree/main/devin-action/examples) +- [Devin API Documentation](https://docs.devin.ai/api-reference/overview) + +## Troubleshooting + +### Workflow Fails with Authentication Error +- Verify `DEVIN_API_KEY` secret is set correctly +- Check that your API key is still valid in Devin settings +- Ensure the key has necessary permissions + +### Session Creation Fails +- Check Devin API status +- Verify your account has available ACU credits +- Review the workflow logs for specific error messages + +### Unable to Access Session URL +- Ensure you're logged into Devin +- Verify you have access to the session (org permissions) +- Try refreshing the page or clearing browser cache + +## Support + +For issues with: +- **Workflows**: Open an issue in this repository +- **Devin Action**: Visit [DEVIN-GITHUB-ACTIONS Issues](https://github.com/samfert-codeium/DEVIN-GITHUB-ACTIONS/issues) +- **Devin API**: Contact [Devin Support](https://app.devin.ai/support) diff --git a/.github/workflows/devin-code-review.yml b/.github/workflows/devin-code-review.yml new file mode 100644 index 0000000..9048011 --- /dev/null +++ b/.github/workflows/devin-code-review.yml @@ -0,0 +1,136 @@ +name: Automated Code Review with Devin + +on: + pull_request: + types: [opened, synchronize] + workflow_dispatch: + inputs: + review_focus: + description: 'Specific area to focus the review on' + required: false + default: 'General code quality and best practices' + +jobs: + devin-review: + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get PR details + id: pr-info + if: github.event_name == 'pull_request' + run: | + echo "pr-number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT + echo "pr-title=${{ github.event.pull_request.title }}" >> $GITHUB_OUTPUT + echo "pr-url=${{ github.event.pull_request.html_url }}" >> $GITHUB_OUTPUT + + - name: Create Devin Session for Code Review + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + id: create-session + with: + action: 'create-session' + api-key: ${{ secrets.DEVIN_API_KEY }} + prompt: | + Review the code changes in this pull request for the Banking Microservices application. + + Focus areas: + 1. Code quality and best practices + 2. Security vulnerabilities (especially in authentication and financial transactions) + 3. Spring Boot and microservices patterns + 4. Database interactions and transaction handling + 5. API endpoint security and validation + 6. Test coverage and quality + + ${{ github.event_name == 'workflow_dispatch' && format('Additional focus: {0}', github.event.inputs.review_focus) || '' }} + + Pull Request: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || 'Manual review triggered' }} + + Repository: ${{ github.repository }} + Branch: ${{ github.head_ref || github.ref_name }} + title: 'Code Review - ${{ github.event_name == ''pull_request'' && github.event.pull_request.title || ''Manual Review'' }}' + tags: 'code-review,banking-microservices,automated' + + - name: Send Microservices Context + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + with: + action: 'send-message' + api-key: ${{ secrets.DEVIN_API_KEY }} + session-id: ${{ steps.create-session.outputs.session-id }} + message: | + This is a Spring Boot microservices application with the following services: + - Service Registry (Eureka) + - API Gateway (Spring Cloud Gateway with OAuth2) + - User Service (Keycloak integration) + - Account Service (Account management) + - Fund Transfer Service (Inter-account transfers) + - Transaction Service (Deposits/withdrawals) + - Sequence Generator (Unique ID generation) + + Pay special attention to: + - Security in API Gateway and service authentication + - Transaction integrity in Fund Transfer and Transaction services + - Database isolation (each service has its own database) + - Service discovery and inter-service communication patterns + + - name: Add Session Tags + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + with: + action: 'update-tags' + api-key: ${{ secrets.DEVIN_API_KEY }} + session-id: ${{ steps.create-session.outputs.session-id }} + tags: 'code-review,banking-microservices,automated,spring-boot,microservices' + + - name: Comment on PR with Devin Session + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + const sessionUrl = '${{ steps.create-session.outputs.session-url }}'; + const sessionId = '${{ steps.create-session.outputs.session-id }}'; + + const comment = `## 🤖 Devin Code Review + + Devin is reviewing this pull request for: + - Code quality and best practices + - Security vulnerabilities + - Spring Boot and microservices patterns + - Test coverage + + **Session URL**: ${sessionUrl} + **Session ID**: \`${sessionId}\` + + Devin will analyze the changes and provide feedback. You can monitor the progress at the session URL above. + + --- + *This review was automatically triggered by the GitHub Actions workflow.*`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + }); + + - name: Output Session Information + run: | + echo "===================================" + echo "Devin Session Created Successfully" + echo "===================================" + echo "" + echo "Session ID: ${{ steps.create-session.outputs.session-id }}" + echo "Session URL: ${{ steps.create-session.outputs.session-url }}" + echo "" + echo "Monitor the session at: ${{ steps.create-session.outputs.session-url }}" + echo "" + if [ "${{ steps.create-session.outputs.is-new-session }}" = "true" ]; then + echo "✓ New session created" + else + echo "⟳ Reusing existing session (idempotent)" + fi diff --git a/.github/workflows/devin-test-fix.yml b/.github/workflows/devin-test-fix.yml new file mode 100644 index 0000000..8f07624 --- /dev/null +++ b/.github/workflows/devin-test-fix.yml @@ -0,0 +1,102 @@ +name: Fix Failing Tests with Devin + +on: + workflow_dispatch: + inputs: + service_name: + description: 'Service to fix (or "all" for all services)' + required: true + type: choice + options: + - all + - Service-Registry + - Sequence-Generator + - API-Gateway + - User-Service + - Account-Service + - Fund-Transfer + - Transaction-Service + additional_instructions: + description: 'Additional instructions for Devin' + required: false + default: '' + +jobs: + create-devin-session: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Tests to Identify Failures + id: test-run + continue-on-error: true + run: | + if [ "${{ github.event.inputs.service_name }}" = "all" ]; then + cd ~/repos/BankingMicroservices + for service in Service-Registry Sequence-Generator API-Gateway; do + echo "Testing $service..." + cd $service && mvn test -q && cd .. + done + else + cd "${{ github.event.inputs.service_name }}" + mvn test + fi + + - name: Create Devin Session to Fix Tests + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + id: fix-tests + with: + action: 'create-session' + api-key: ${{ secrets.DEVIN_API_KEY }} + prompt: | + Fix the failing tests in the Banking Microservices application. + + Service to fix: ${{ github.event.inputs.service_name }} + + Tasks: + 1. Identify all failing tests + 2. Analyze the root cause of failures + 3. Fix the code to make tests pass + 4. Ensure no regression in other tests + 5. Run tests to verify fixes + + ${{ github.event.inputs.additional_instructions && format('Additional instructions: {0}', github.event.inputs.additional_instructions) || '' }} + + Repository: ${{ github.repository }} + Branch: ${{ github.ref_name }} + title: 'Fix Tests - ${{ github.event.inputs.service_name }}' + tags: 'test-fix,banking-microservices,automated' + max-acu-limit: 2000 + + - name: Send Test Context + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + with: + action: 'send-message' + api-key: ${{ secrets.DEVIN_API_KEY }} + session-id: ${{ steps.fix-tests.outputs.session-id }} + message: | + Test execution completed. Check the test output above for details. + + After fixing the tests, please: + 1. Run the test verification command to ensure all tests pass + 2. Run the lint command to ensure code quality + 3. Create a pull request with your fixes + + Test command: cd ~/repos/BankingMicroservices && for service in Service-Registry Sequence-Generator API-Gateway; do echo "Testing $service..."; cd $service && mvn test -q && cd ..; done + + Lint command: cd ~/repos/BankingMicroservices && for service in Service-Registry Sequence-Generator API-Gateway User-Service Account-Service Fund-Transfer Transaction-Service; do echo "Compiling $service..."; cd $service && mvn compile && cd ..; done + + - name: Output Session Information + run: | + echo "===================================" + echo "Devin Session Created" + echo "===================================" + echo "" + echo "Session ID: ${{ steps.fix-tests.outputs.session-id }}" + echo "Session URL: ${{ steps.fix-tests.outputs.session-url }}" + echo "" + echo "Devin will work on fixing the tests for: ${{ github.event.inputs.service_name }}" + echo "" + echo "Monitor progress at: ${{ steps.fix-tests.outputs.session-url }}" From 74e00929573d884063a2cd34cd08a9d1bec5dac5 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 01:14:11 +0000 Subject: [PATCH 2/2] Fix workflow action references to use PR branch - Update devin-code-review.yml to reference PR branch instead of @main - Update devin-test-fix.yml to reference PR branch instead of @main - This allows CI to pass while the action is still in PR review - Once DEVIN-GITHUB-ACTIONS PR is merged, these should be updated to use stable version tags Co-Authored-By: Sam Fertig --- .github/workflows/devin-code-review.yml | 6 +++--- .github/workflows/devin-test-fix.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/devin-code-review.yml b/.github/workflows/devin-code-review.yml index 9048011..739acc7 100644 --- a/.github/workflows/devin-code-review.yml +++ b/.github/workflows/devin-code-review.yml @@ -32,7 +32,7 @@ jobs: echo "pr-url=${{ github.event.pull_request.html_url }}" >> $GITHUB_OUTPUT - name: Create Devin Session for Code Review - uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@devin/1762304734-devin-action-implementation id: create-session with: action: 'create-session' @@ -58,7 +58,7 @@ jobs: tags: 'code-review,banking-microservices,automated' - name: Send Microservices Context - uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@devin/1762304734-devin-action-implementation with: action: 'send-message' api-key: ${{ secrets.DEVIN_API_KEY }} @@ -80,7 +80,7 @@ jobs: - Service discovery and inter-service communication patterns - name: Add Session Tags - uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@devin/1762304734-devin-action-implementation with: action: 'update-tags' api-key: ${{ secrets.DEVIN_API_KEY }} diff --git a/.github/workflows/devin-test-fix.yml b/.github/workflows/devin-test-fix.yml index 8f07624..2cf64d9 100644 --- a/.github/workflows/devin-test-fix.yml +++ b/.github/workflows/devin-test-fix.yml @@ -45,7 +45,7 @@ jobs: fi - name: Create Devin Session to Fix Tests - uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@devin/1762304734-devin-action-implementation id: fix-tests with: action: 'create-session' @@ -71,7 +71,7 @@ jobs: max-acu-limit: 2000 - name: Send Test Context - uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@devin/1762304734-devin-action-implementation with: action: 'send-message' api-key: ${{ secrets.DEVIN_API_KEY }}