{ "nodes": [ { "id": "8a36e8d4-a3bf-44e1-894a-db00bad99151", "name": "Fetch Github Repo Releases", "type": "n8n-nodes-base.httpRequest", "position": [ 880, 240 ], "parameters": { "url": "=https://api.github.com/repos/{{ $json[\"github-org\"] }}/{{ $json[\"github-repo\"] }}/releases/latest", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "User-Agent", "value": "awesome-workflow-templates" } ] }, "options": {} }, "typeVersion": 4.2, "alwaysOutputData": false }, { "id": "4803248b-3ff7-4994-a105-3d8ef68bd45d", "name": "Daily Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [ 380, 240 ], "parameters": { "rule": { "interval": [ { "field": "cronExpression", "expression": "0 0 * * *" } ] } }, "typeVersion": 1.2 }, { "id": "0b2122d7-18cf-49b8-b10e-a8132df8ceb9", "name": "RepoConfig", "type": "n8n-nodes-base.code", "position": [ 620, 240 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "return [{\"owner\":\"n8n-io\",\"repo\":\"n8n\"},{\"owner\":\"home-assistant\",\"repo\":\"core\"}].map(({owner,repo})=>({json:{\"github-org\":owner,\"github-repo\":repo},pairedItem:{item:0}}));" }, "typeVersion": 2 }, { "id": "60918b67-76bb-4c9e-bc84-845d59fced76", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 540, 100 ], "parameters": { "width": 269, "height": 278, "content": "### Setup repos here to check releases for.\n\nAdd a new json object to the array setting the org and repo, these will be used by the following nodes" }, "typeVersion": 1 }, { "id": "66fbb663-cd52-471c-be8b-4175f754d02d", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ 1300, 120 ], "parameters": { "height": 254, "content": "### Setup Slack notification\n\nUpdate this node to customise your Slack notification" }, "typeVersion": 1 }, { "id": "9b04cdd2-e369-4862-b376-9945e93c0aaf", "name": "Wether Release is new", "type": "n8n-nodes-base.code", "position": [ 1080, 240 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "const business = function recentReleases({ releases }) {\n const cutoff = Date.now() - 24 * 60 * 60 * 1000;\n const escape = (value) => value.replace(/&/g, '&').replace(//g, '>');\n const notifications = [];\n for (const [index, { owner, repo, release }] of releases.entries()) {\n const published = typeof release.published_at === 'string' ? Date.parse(release.published_at) : NaN;\n if (!Number.isFinite(published)) throw new Error('Release is missing a valid publication timestamp');\n if (!(published > cutoff)) continue;\n const name = release.name || release.tag_name;\n if (typeof name !== 'string' || !name || typeof release.html_url !== 'string' || !release.html_url) throw new Error('Release is missing its name or URL');\n const body = release.body ?? '';\n if (typeof body !== 'string') throw new Error('Release body must be text or null');\n notifications.push({\n text: `:tada: New release for *${escape(owner + '/' + repo)}* - ${escape(name)}\\n\\n${escape(body.slice(0, 500))}\\n\\n${release.html_url}`,\n sourceIndex: index,\n });\n }\n return { notifications, count: notifications.length };\n}\n\nconst releases = $input.all().map((item,index)=>{const repo=$(\"RepoConfig\").itemMatching(index).json;return {owner:repo[\"github-org\"],repo:repo[\"github-repo\"],release:item.json};});\nreturn business({releases}).notifications.map(({text,sourceIndex})=>({json:{text},pairedItem:{item:sourceIndex}}));\n" }, "typeVersion": 2 }, { "id": "4ad55bb4-89d2-4f1d-bcb5-fe60aa4f8c79", "name": "Send Message", "type": "n8n-nodes-base.slack", "position": [ 1380, 220 ], "parameters": { "resource": "message", "operation": "post", "select": "channel", "channelId": { "__rl": true, "mode": "id", "value": "YOUR_SLACK_CHANNEL_ID" }, "text": "={{ $json.text }}", "otherOptions": { "includeLinkToWorkflow": false, "mrkdwn": true } }, "typeVersion": 2.2 } ], "pinData": {}, "connections": { "RepoConfig": { "main": [ [ { "node": "Fetch Github Repo Releases", "type": "main", "index": 0 } ] ] }, "Daily Trigger": { "main": [ [ { "node": "RepoConfig", "type": "main", "index": 0 } ] ] }, "Wether Release is new": { "main": [ [ { "node": "Send Message", "type": "main", "index": 0 } ] ] }, "Fetch Github Repo Releases": { "main": [ [ { "node": "Wether Release is new", "type": "main", "index": 0 } ] ] } }, "name": "GitHub Release Slack Alerts", "settings": { "executionOrder": "v1", "timezone": "UTC" }, "active": false }