Skip to content

Commit 1805da5

Browse files
2 parents aeb1ce9 + 4e6de22 commit 1805da5

2 files changed

Lines changed: 184 additions & 0 deletions

File tree

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
{
2+
"name": "GitHub PR Classifier",
3+
"nodes": [
4+
{
5+
"parameters": {
6+
"httpMethod": "POST",
7+
"path": "github-pr",
8+
"options": {}
9+
},
10+
"type": "n8n-nodes-base.webhook",
11+
"typeVersion": 2.1,
12+
"position": [
13+
0,
14+
0
15+
],
16+
"id": "6e4987d2-72c9-4d4c-8839-625f7849c692",
17+
"name": "Webhook",
18+
"webhookId": "4b7d7a1a-22cb-4b3d-a469-2192fea108e9"
19+
},
20+
{
21+
"parameters": {
22+
"mode": "runOnceForEachItem",
23+
"jsCode": "const payload = $json.body;\n\nif (payload.pull_request) {\n\n return {\n title: payload.pull_request.title,\n body: payload.pull_request.body || \"\",\n number: payload.pull_request.number,\n repo: payload.repository.name,\n owner: payload.repository.owner.login,\n type: \"pr\"\n };\n\n}\n\nif (payload.issue) {\n\n return {\n title: payload.issue.title,\n body: payload.issue.body || \"\",\n number: payload.issue.number,\n repo: payload.repository.name,\n owner: payload.repository.owner.login,\n type: \"issue\"\n };\n\n}\n\nreturn {\n error: \"Unsupported GitHub webhook event\",\n received_keys: Object.keys(payload)\n};"
24+
},
25+
"type": "n8n-nodes-base.code",
26+
"typeVersion": 2,
27+
"position": [
28+
224,
29+
112
30+
],
31+
"id": "036ed412-ca19-4ae1-9637-40d8f0e08c9f",
32+
"name": "Normalize"
33+
},
34+
{
35+
"parameters": {
36+
"mode": "runOnceForEachItem",
37+
"jsCode": "return {\n owner: $('Normalize').first().json.owner,\n repo: $('Normalize').first().json.repo,\n number: $('Normalize').first().json.number,\n\n github_labels: $json.github_labels,\n sentiment: $json.sentiment,\n priority_score: $json.priority_score\n};"
38+
},
39+
"type": "n8n-nodes-base.code",
40+
"typeVersion": 2,
41+
"position": [
42+
624,
43+
0
44+
],
45+
"id": "08b19364-31ed-4f85-b7b6-ca21aedb5a61",
46+
"name": "Final Clean"
47+
},
48+
{
49+
"parameters": {
50+
"method": "POST",
51+
"url": "http://host.docker.internal:8000/predict",
52+
"sendBody": true,
53+
"contentType": "=json",
54+
"bodyParameters": {
55+
"parameters": [
56+
{
57+
"name": "title",
58+
"value": "={{ $json.title }}"
59+
},
60+
{
61+
"name": "body",
62+
"value": "={{ $json.body }}"
63+
}
64+
]
65+
},
66+
"options": {}
67+
},
68+
"type": "n8n-nodes-base.httpRequest",
69+
"typeVersion": 4.4,
70+
"position": [
71+
416,
72+
0
73+
],
74+
"id": "abb535d2-d9a7-43bd-ae63-663d30d2fe6d",
75+
"name": "Predict Request"
76+
},
77+
{
78+
"parameters": {
79+
"method": "POST",
80+
"url": "=https://api.github.com/repos/{{ $json.owner }}/{{ $json.repo }}/issues/{{ $json.number }}/labels",
81+
"authentication": "genericCredentialType",
82+
"genericAuthType": "httpHeaderAuth",
83+
"sendHeaders": true,
84+
"headerParameters": {
85+
"parameters": [
86+
{
87+
"name": "Accept",
88+
"value": "application/vnd.github+json"
89+
}
90+
]
91+
},
92+
"sendBody": true,
93+
"specifyBody": "json",
94+
"jsonBody": "={\n \"labels\": {{ JSON.stringify($json.github_labels) }}\n}",
95+
"options": {}
96+
},
97+
"type": "n8n-nodes-base.httpRequest",
98+
"typeVersion": 4.4,
99+
"position": [
100+
832,
101+
0
102+
],
103+
"id": "7348b5c0-8419-45ee-8d1d-a5ab7f778c57",
104+
"name": "Write Request",
105+
"credentials": {
106+
"httpHeaderAuth": {
107+
"id": "LHWBA3pAyVX1d6wL",
108+
"name": "Header Auth account"
109+
}
110+
}
111+
}
112+
],
113+
"pinData": {
114+
"Normalize": [
115+
{
116+
"json": {
117+
"title": "Upload n8n automation workflow files",
118+
"body": "- Upload the JSON Workflow file for n8n automation.\n- Make sure that no sensitive data exists in the file.\n- Upload a screenshot of the workflow.\n- Add the documentation afterwards in the documentation/automation folder, which is necessary to understand and implement the workflow.",
119+
"number": 2,
120+
"repo": "Git-PR-Analyzer",
121+
"owner": "syedsufyan-coder",
122+
"type": "issue"
123+
}
124+
}
125+
]
126+
},
127+
"connections": {
128+
"Webhook": {
129+
"main": [
130+
[
131+
{
132+
"node": "Normalize",
133+
"type": "main",
134+
"index": 0
135+
}
136+
]
137+
]
138+
},
139+
"Normalize": {
140+
"main": [
141+
[
142+
{
143+
"node": "Predict Request",
144+
"type": "main",
145+
"index": 0
146+
}
147+
]
148+
]
149+
},
150+
"Final Clean": {
151+
"main": [
152+
[
153+
{
154+
"node": "Write Request",
155+
"type": "main",
156+
"index": 0
157+
}
158+
]
159+
]
160+
},
161+
"Predict Request": {
162+
"main": [
163+
[
164+
{
165+
"node": "Final Clean",
166+
"type": "main",
167+
"index": 0
168+
}
169+
]
170+
]
171+
}
172+
},
173+
"active": true,
174+
"settings": {
175+
"executionOrder": "v1",
176+
"binaryMode": "separate"
177+
},
178+
"versionId": "1886be5b-01b4-4b5c-91f3-54f8dc301155",
179+
"meta": {
180+
"instanceId": "1a149f0b90f998f8b1765ebd03f3957a87ef5ba755980789d7ef683d013bf8eb"
181+
},
182+
"id": "Ta1nV3VYu5eV8STz",
183+
"tags": []
184+
}

automation/Workflow Screenshot.png

137 KB
Loading

0 commit comments

Comments
 (0)