Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion devin-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
14 changes: 12 additions & 2 deletions devin-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}"
33 changes: 32 additions & 1 deletion devin-action/scripts/devin-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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