From d408256e9b8b3f2ee5380402d0578e5025f58bf0 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 17:19:42 +0000 Subject: [PATCH] Add download-attachment-files endpoint to complete Devin API support - Implement download_attachment_files function in devin-api.sh - Add attachment-uuid and attachment-name inputs to action.yml - Update documentation with download-attachment-files examples - Now supports all 19 Devin API endpoints This completes the implementation to support all functionalities described in the Devin API documentation. Co-Authored-By: Sam Fertig --- devin-action/README.md | 22 ++++++++++++++++++++- devin-action/action.yml | 14 +++++++++++-- devin-action/scripts/devin-api.sh | 33 ++++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/devin-action/README.md b/devin-action/README.md index 689401f..9c4f8c3 100644 --- a/devin-action/README.md +++ b/devin-action/README.md @@ -6,7 +6,7 @@ A comprehensive GitHub Action for interacting with the Devin API to create and m This action supports all Devin API functionalities: -- **Session Management**: Create sessions, send messages, get session details, list sessions, upload files, update tags +- **Session Management**: Create sessions, send messages, get session details, list sessions, upload files, download attachment files, update tags - **Secrets Management**: List, create, and delete secrets - **Knowledge Management**: List, create, update, and delete knowledge - **Playbooks Management**: List, create, get, update, and delete playbooks @@ -128,6 +128,23 @@ Before using this action, you need: tags: 'completed,reviewed,deployed' ``` +#### Download Attachment Files + +```yaml +- name: Download Attachment from Session + uses: samfert-codeium/DEVIN-GITHUB-ACTIONS/devin-action@main + id: download-attachment + with: + action: 'download-attachment-files' + api-key: ${{ secrets.DEVIN_API_KEY }} + attachment-uuid: 'uuid_123456' + attachment-name: 'report.pdf' + +- name: Save Attachment + run: | + echo "${{ steps.download-attachment.outputs.response }}" > report.pdf +``` + ### Secrets Management #### List Secrets @@ -232,6 +249,8 @@ Before using this action, you need: | `playbook-id` | Playbook ID | For playbook operations | - | | `playbook-name` | Playbook name | For playbook operations | - | | `playbook-content` | Playbook content | For playbook operations | - | +| `attachment-uuid` | Attachment UUID | For `download-attachment-files` | - | +| `attachment-name` | Attachment filename | For `download-attachment-files` | - | ## Outputs @@ -249,6 +268,7 @@ Before using this action, you need: - `get-session` - Get details about a session - `list-sessions` - List all sessions - `upload-files` - Upload files to a session +- `download-attachment-files` - Download attachment files from a session - `update-tags` - Update session tags - `list-secrets` - List all secrets - `create-secret` - Create a new secret diff --git a/devin-action/action.yml b/devin-action/action.yml index 82b774b..36d38ba 100644 --- a/devin-action/action.yml +++ b/devin-action/action.yml @@ -8,7 +8,7 @@ branding: inputs: action: - description: 'The API action to perform (create-session, send-message, get-session, list-sessions, upload-files, update-tags, list-secrets, create-secret, delete-secret, list-knowledge, create-knowledge, update-knowledge, delete-knowledge, list-playbooks, create-playbook, get-playbook, update-playbook, delete-playbook)' + description: 'The API action to perform (create-session, send-message, get-session, list-sessions, upload-files, update-tags, list-secrets, create-secret, delete-secret, list-knowledge, create-knowledge, update-knowledge, delete-knowledge, list-playbooks, create-playbook, get-playbook, update-playbook, delete-playbook, download-attachment-files)' required: true api-key: @@ -100,6 +100,14 @@ inputs: playbook-content: description: 'Playbook content (for create-playbook, update-playbook)' required: false + + attachment-uuid: + description: 'Attachment UUID (required for download-attachment-files)' + required: false + + attachment-name: + description: 'Attachment filename (required for download-attachment-files)' + required: false outputs: session-id: @@ -148,4 +156,6 @@ runs: "${{ inputs.knowledge-content }}" \ "${{ inputs.playbook-id }}" \ "${{ inputs.playbook-name }}" \ - "${{ inputs.playbook-content }}" + "${{ inputs.playbook-content }}" \ + "${{ inputs.attachment-uuid }}" \ + "${{ inputs.attachment-name }}" diff --git a/devin-action/scripts/devin-api.sh b/devin-action/scripts/devin-api.sh index 2c7eefa..3db76fe 100755 --- a/devin-action/scripts/devin-api.sh +++ b/devin-action/scripts/devin-api.sh @@ -25,6 +25,8 @@ KNOWLEDGE_CONTENT="${20}" PLAYBOOK_ID="${21}" PLAYBOOK_NAME="${22}" PLAYBOOK_CONTENT="${23}" +ATTACHMENT_UUID="${24}" +ATTACHMENT_NAME="${25}" BASE_URL="https://api.devin.ai/v1" @@ -341,6 +343,32 @@ function delete_playbook() { echo "response=${response}" >> $GITHUB_OUTPUT } +function download_attachment_files() { + if [ -z "$ATTACHMENT_UUID" ] || [ -z "$ATTACHMENT_NAME" ]; then + echo "Error: attachment-uuid and attachment-name are required for download-attachment-files action" + exit 1 + fi + + response=$(curl -s -L -X GET "${BASE_URL}/attachments/${ATTACHMENT_UUID}/${ATTACHMENT_NAME}" \ + -H "Authorization: Bearer ${API_KEY}" \ + -w "\n%{http_code}") + + http_code=$(echo "$response" | tail -n1) + body=$(echo "$response" | sed '$d') + + if [ "$http_code" = "200" ] || [ "$http_code" = "307" ]; then + echo "${body}" + echo "response=${body}" >> $GITHUB_OUTPUT + echo "http-code=${http_code}" >> $GITHUB_OUTPUT + else + echo "Error: Failed to download attachment. HTTP code: ${http_code}" + echo "${body}" + echo "response=${body}" >> $GITHUB_OUTPUT + echo "http-code=${http_code}" >> $GITHUB_OUTPUT + exit 1 + fi +} + case "$ACTION" in create-session) create_session @@ -396,9 +424,12 @@ case "$ACTION" in delete-playbook) delete_playbook ;; + download-attachment-files) + download_attachment_files + ;; *) echo "Error: Unknown action '${ACTION}'" - echo "Valid actions: create-session, send-message, get-session, list-sessions, upload-files, update-tags, list-secrets, create-secret, delete-secret, list-knowledge, create-knowledge, update-knowledge, delete-knowledge, list-playbooks, create-playbook, get-playbook, update-playbook, delete-playbook" + echo "Valid actions: create-session, send-message, get-session, list-sessions, upload-files, update-tags, list-secrets, create-secret, delete-secret, list-knowledge, create-knowledge, update-knowledge, delete-knowledge, list-playbooks, create-playbook, get-playbook, update-playbook, delete-playbook, download-attachment-files" exit 1 ;; esac