n8n
Workflow
Create An Issue On Gitlab On Every Github Release
This n8n workflow automates tasks using GitHub. Create An Issue On Gitlab On Every Github Release - ready to import and run in your n8n instance.
n8n
workflow.json
About This Script
This n8n workflow automates tasks using GitHub. Create An Issue On Gitlab On Every Github Release - ready to import and run in your n8n instance.
Features:
- Scheduled automation with cron triggers
- Custom JavaScript function processing
- Integrates with GitHub
- Scheduled execution
Source Code
{
"nodes": [
{
"name": "Get latest release",
"type": "n8n-nodes-base.github",
"position": [
540,
340
],
"parameters": {
"limit": 1,
"resource": "release",
"operation": "getAll"
},
"typeVersion": 1,
"id": "f7b3effd-cd44-4072-b4e9-1bb6e275f359"
},
{
"name": "Cron",
"type": "n8n-nodes-base.cron",
"position": [
240,
500
],
"parameters": {
"triggerTimes": {
"item": [
{
"mode": "everyWeek"
}
]
}
},
"typeVersion": 1,
"id": "cf15d6a7-3a30-4413-876c-7953c6df5ed5"
},
{
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
740,
420
],
"parameters": [],
"typeVersion": 1,
"id": "f9ca4b04-15af-49aa-8202-04298cce77de"
},
{
"name": "No issue for release?",
"type": "n8n-nodes-base.function",
"position": [
920,
420
],
"parameters": {
"functionCode": "const _ = require('lodash')\n\n// differentiate merged inputs (didnt find a way to get both inputs into one function invocation)\nconst releases = _.filter(items, i => _.has(i, 'json.assets'))\nif (releases.length != 1) throw new Error(`Invalid release count: ${releases.length}`)\nconst release = releases[0]\nconst issues = _.without(items, release)\n//console.log({release,issues})\n\n// check if there's an issue for the release\nconst matchingIssue = _.find(issues, i => i.json.title.includes(release.json.tag_name))\n//console.log({release,issues,matchingIssue})\n\nif (matchingIssue)\n return []\nelse\n return [release]"
},
"executeOnce": false,
"typeVersion": 1,
"id": "e24e4df0-0caf-4e7e-a59a-9b8f9c391832"
},
{
"name": "Create issue",
"type": "n8n-nodes-base.gitlab",
"position": [
1100,
420
],
"parameters": {
"body": "={{$json[\"url\"]}}\n\n{{$json[\"body\"]}}",
"owner": "txlab",
"title": "=Upstream release: {{$json[\"tag_name\"]}}",
"labels": [],
"repository": "docker-linkcheck",
"assignee_ids": []
},
"typeVersion": 1,
"id": "45271cbb-0adf-4052-b7b4-d1b9bda2dfa0"
},
{
"name": "List issues",
"type": "n8n-nodes-base.gitlab",
"position": [
540,
500
],
"parameters": {
"owner": "txlab",
"resource": "repository",
"repository": "docker-linkcheck",
"getRepositoryIssuesFilters": []
},
"typeVersion": 1,
"id": "9a1116fc-f0b7-4ce5-bab4-e6ef9cc5a0fb"
}
],
"connections": {
"Cron": {
"main": [
[
{
"node": "Get latest release",
"type": "main",
"index": 0
},
{
"node": "List issues",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "No release for issue?",
"type": "main",
"index": 0
}
]
]
},
"Start": {
"main": [
[
{
"node": "Get latest release",
"type": "main",
"index": 0
},
{
"node": "List issues",
"type": "main",
"index": 0
}
]
]
},
"List issues": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Get latest release": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"No release for issue?": {
"main": [
[
{
"node": "Create issue",
"type": "main",
"index": 0
}
]
]
}
},
"n8n_version": "1.5.0"
}
Requirements
n8n instance, Github API credentials
Tags
#n8n
#automation
#workflow