mvp-factory-openhands/N8N_OPENHANDS_WORKFLOW_FINA...

247 lines
7.9 KiB
JSON

{
"updatedAt": "2025-12-01T21:42:43.122Z",
"createdAt": "2025-12-01T21:42:43.020Z",
"id": "j1MmXaRhDjvkRSLa",
"name": "Gitea \u2192 OpenHands - FIXED WITH PASSTHROUGH",
"description": null,
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "openhands-fixed-test",
"options": {}
},
"id": "webhook-trigger",
"name": "Gitea Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1.1,
"position": [
240,
300
],
"webhookId": "openhands-fixed-test"
},
{
"parameters": {
"jsCode": "// CORRECT: Data is in $json.body\nconst payload = $json.body;\n\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\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 status: 'PENDING',\n retry_count: 0\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": "fixed-session",
"authentication": "privateKey",
"options": {
"passThrough": true
}
},
"id": "execute-sdk-ssh",
"name": "Start OpenHands Build - FIXED",
"type": "n8n-nodes-base.ssh",
"typeVersion": 1,
"position": [
680,
300
],
"credentials": {
"sshPrivateKey": {
"id": "v2BMXeCFGpXaoIyb",
"name": "SSH Private Key account"
}
}
},
{
"parameters": {
"amount": 10,
"unit": "seconds"
},
"id": "wait-initial",
"name": "Wait 10s for Initialization",
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
900,
300
]
},
{
"parameters": {
"jsCode": "// FIXED: Get repo data from previous node using $node\nconst sshOutput = $json;\nconst repoData = $node[\"Extract Repo Info\"].json;\n\n// Merge the SSH output with the original repo data\nreturn {\n ...repoData,\n code: sshOutput.code,\n signal: sshOutput.signal,\n stdout: sshOutput.stdout,\n stderr: sshOutput.stderr,\n status: 'SUCCESS',\n message: 'Build completed successfully',\n timestamp: new Date().toISOString()\n};"
},
"id": "check-build-status",
"name": "Check Build Status - Data Check",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1120,
300
]
},
{
"parameters": {
"jsCode": "// Format build response\nconst item = $json;\n\n// Log what we received for debugging\nconsole.log('Final item received:', JSON.stringify(item, null, 2));\n\nconst result = {\n status: item.status || 'SUCCESS',\n repo: item.repo_full_name || 'unknown',\n branch: item.branch || 'main',\n commit: item.commit_sha ? item.commit_sha.substring(0, 8) : 'N/A',\n message: item.message || 'Build completed',\n timestamp: new Date().toISOString(),\n retry_count: item.retry_count || 0\n};\n\n// Add emoji\nif (result.status === 'SUCCESS') {\n result.emoji = '\u2705';\n} else if (result.status === 'FAILED') {\n result.emoji = '\u274c';\n} else {\n result.emoji = '\u26a0\ufe0f';\n}\n\nreturn result;"
},
"id": "format-response",
"name": "Format Build Response - FINAL",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1340,
300
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ $json }}",
"options": {}
},
"id": "send-response",
"name": "Send Response",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1560,
300
]
}
],
"connections": {
"Gitea Webhook": {
"main": [
[
{
"node": "Extract Repo Info",
"type": "main",
"index": 0
}
]
]
},
"Extract Repo Info": {
"main": [
[
{
"node": "Start OpenHands Build - FIXED",
"type": "main",
"index": 0
}
]
]
},
"Start OpenHands Build - FIXED": {
"main": [
[
{
"node": "Wait 10s for Initialization",
"type": "main",
"index": 0
}
]
]
},
"Wait 10s for Initialization": {
"main": [
[
{
"node": "Check Build Status - Data Check",
"type": "main",
"index": 0
}
]
]
},
"Check Build Status - Data Check": {
"main": [
[
{
"node": "Format Build Response - FINAL",
"type": "main",
"index": 0
}
]
]
},
"Format Build Response - FINAL": {
"main": [
[
{
"node": "Send Response",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false
},
"staticData": {},
"meta": null,
"pinData": null,
"versionId": "e98dcf53-4f3e-4eee-8a18-6b7bc4ca7c70",
"versionCounter": 3,
"triggerCount": 1,
"shared": [
{
"updatedAt": "2025-12-01T21:42:43.023Z",
"createdAt": "2025-12-01T21:42:43.023Z",
"role": "workflow:owner",
"workflowId": "j1MmXaRhDjvkRSLa",
"projectId": "18Ie3sGopJUKowvQ",
"project": {
"updatedAt": "2025-11-28T21:55:42.833Z",
"createdAt": "2025-11-28T21:54:40.915Z",
"id": "18Ie3sGopJUKowvQ",
"name": "pi raj <aidev@oky.sh>",
"type": "personal",
"icon": null,
"description": null,
"projectRelations": [
{
"updatedAt": "2025-11-28T21:54:40.915Z",
"createdAt": "2025-11-28T21:54:40.915Z",
"userId": "9ac6189d-d9fb-457e-893e-27b9af3fa738",
"projectId": "18Ie3sGopJUKowvQ",
"user": {
"updatedAt": "2025-12-01T18:14:07.000Z",
"createdAt": "2025-11-28T21:54:40.486Z",
"id": "9ac6189d-d9fb-457e-893e-27b9af3fa738",
"email": "aidev@oky.sh",
"firstName": "pi",
"lastName": "raj",
"personalizationAnswers": {
"version": "v4",
"personalization_survey_submitted_at": "2025-11-28T21:55:59.720Z",
"personalization_survey_n8n_version": "1.121.3"
},
"settings": {
"userActivated": true,
"firstSuccessfulWorkflowId": "hwbFEoEIgGyjV0He",
"userActivatedAt": 1764591198155
},
"disabled": false,
"mfaEnabled": false,
"lastActiveAt": "2025-12-01",
"isPending": false
}
}
]
}
}
],
"tags": []
}