104 lines
3.4 KiB
JSON
104 lines
3.4 KiB
JSON
{
|
|
"name": "Gitea → OpenHands SDK",
|
|
"active": true,
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "openhands-sdk",
|
|
"options": {}
|
|
},
|
|
"id": "webhook-trigger",
|
|
"name": "Gitea Webhook",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 1.1,
|
|
"position": [240, 300],
|
|
"webhookId": "openhands-sdk"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "// Extract repository and commit information from Gitea webhook\nconst payload = $input.item.json;\n\n// Extract key information\nconst repoName = payload.repository?.name || 'unknown';\nconst repoFullName = payload.repository?.full_name || 'unknown';\nconst repoCloneUrl = payload.repository?.clone_url || '';\nconst branch = payload.ref?.replace('refs/heads/', '') || 'main';\nconst commitSha = payload.after || '';\nconst commitMessage = payload.commits?.[0]?.message || 'No message';\nconst pusher = payload.pusher?.username || 'unknown';\n\n// Create task message for OpenHands SDK - Build a complete task\nconst task = 'Build and test project ' + repoFullName + ' on branch ' + branch + '. ' +\n 'Latest commit: \"' + commitMessage + '\". ' +\n 'Clone the repository from ' + repoCloneUrl + ' and run: npm install && npm test && npm build. ' +\n 'Report any errors found.';\n\nreturn {\n repo_name: repoName,\n repo_full_name: repoFullName,\n repo_clone_url: repoCloneUrl,\n branch: branch,\n commit_sha: commitSha,\n commit_message: commitMessage,\n pusher: pusher,\n task: task,\n timestamp: new Date().toISOString()\n};"
|
|
},
|
|
"id": "extract-repo-info",
|
|
"name": "Extract Repo Info",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [460, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"command": "={{ 'sh /home/bam/claude/mvp-factory/openhands-sdk-wrapper-sh.sh \"' + $json.task + '\"' }}",
|
|
"sessionId": "gitea-session",
|
|
"authentication": "privateKey"
|
|
},
|
|
"id": "execute-sdk-ssh",
|
|
"name": "Execute OpenHands SDK",
|
|
"type": "n8n-nodes-base.ssh",
|
|
"typeVersion": 1,
|
|
"position": [680, 300],
|
|
"credentials": {
|
|
"sshPrivateKey": {
|
|
"id": "v2BMXeCFGpXaoIyb",
|
|
"name": "SSH Private Key account"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"respondWith": "text",
|
|
"responseBody": "✅ Build triggered successfully! OpenHands SDK is executing your task.",
|
|
"options": {}
|
|
},
|
|
"id": "webhook-response",
|
|
"name": "Success Response",
|
|
"type": "n8n-nodes-base.respondToWebhook",
|
|
"typeVersion": 1.1,
|
|
"position": [900, 300]
|
|
}
|
|
],
|
|
"connections": {
|
|
"Gitea Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Extract Repo Info",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Extract Repo Info": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Execute OpenHands SDK",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Execute OpenHands SDK": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Success Response",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"pinData": {},
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
},
|
|
"staticData": null,
|
|
"tags": [],
|
|
"triggerCount": 0,
|
|
"updatedAt": "2025-12-01T17:30:00.000Z",
|
|
"versionId": "1"
|
|
}
|