{ "kind": "open-flow-workflow", "version": 1, "name": "GitHub Devto Engagement", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_ffaf18c47ef103fc": { "name": "Every twelve hours", "kind": "cron", "cronTimes": [ { "type": "cron", "expression": "0 0,12 * * *", "timezone": "UTC" } ] }, "n_5f1e3b8d8d1298f0": { "inputs": { "owner": { "kind": "value", "value": "YOUR_GITHUB_USERNAME" }, "repo": { "kind": "value", "value": "YOUR_REPO_1" } }, "name": "Read first repository", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "owner" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "repo" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "full_name": { "type": "string" }, "private": { "type": "boolean" }, "html_url": { "type": "string" }, "clone_url": { "type": "string" }, "ssh_url": { "type": "string" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "default_branch": { "type": "string" }, "visibility": { "type": "string" }, "fork": { "type": "boolean" }, "owner": { "type": "object", "properties": { "id": { "type": "integer" }, "login": { "type": "string" }, "avatar_url": { "type": "string" }, "html_url": { "type": "string" }, "type": { "type": "string" } }, "additionalProperties": true } }, "additionalProperties": true }, "nullable": false, "handle": "output" } ], "name": "Read first repository", "executor": { "kind": "connector", "action": "github.get_repository", "outputMode": "value" } } }, "n_ff211007578eb968": { "inputs": { "owner": { "kind": "value", "value": "YOUR_GITHUB_USERNAME" }, "repo": { "kind": "value", "value": "YOUR_REPO_2" } }, "name": "Read second repository", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "owner" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "repo" } ], "outputs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "full_name": { "type": "string" }, "private": { "type": "boolean" }, "html_url": { "type": "string" }, "clone_url": { "type": "string" }, "ssh_url": { "type": "string" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "default_branch": { "type": "string" }, "visibility": { "type": "string" }, "fork": { "type": "boolean" }, "owner": { "type": "object", "properties": { "id": { "type": "integer" }, "login": { "type": "string" }, "avatar_url": { "type": "string" }, "html_url": { "type": "string" }, "type": { "type": "string" } }, "additionalProperties": true } }, "additionalProperties": true }, "nullable": false, "handle": "output" } ], "name": "Read second repository", "executor": { "kind": "connector", "action": "github.get_repository", "outputMode": "value" } } }, "n_7b366a8376777ba3": { "inputs": { "username": { "kind": "value", "value": "YOUR_DEVTO_USERNAME" }, "slug": { "kind": "value", "value": "YOUR_ARTICLE_SLUG" } }, "name": "Read article metrics", "kind": "task", "task": { "inputs": [ { "description": "The article author username.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The article author username." }, "nullable": true, "handle": "username", "value": null }, { "description": "The article slug.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The article slug." }, "nullable": true, "handle": "slug", "value": null } ], "outputs": [ { "description": "A Dev.to article record.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Dev.to article record." }, "nullable": false, "handle": "output" } ], "name": "Read article metrics", "executor": { "kind": "connector", "action": "devto.get_article_by_path", "outputMode": "value" } } }, "n_ed02b99b2d628dad": { "inputs": { "repo1": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5f1e3b8d8d1298f0", "output": "output" } ] }, "repo2": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ff211007578eb968", "output": "output" } ] }, "article": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7b366a8376777ba3", "output": "output" } ] } }, "name": "Compile engagement", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "full_name": { "type": "string" }, "private": { "type": "boolean" }, "html_url": { "type": "string" }, "clone_url": { "type": "string" }, "ssh_url": { "type": "string" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "default_branch": { "type": "string" }, "visibility": { "type": "string" }, "fork": { "type": "boolean" }, "owner": { "type": "object", "properties": { "id": { "type": "integer" }, "login": { "type": "string" }, "avatar_url": { "type": "string" }, "html_url": { "type": "string" }, "type": { "type": "string" } }, "additionalProperties": true } }, "additionalProperties": true }, "nullable": false, "handle": "repo1" }, { "jsonSchema": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "full_name": { "type": "string" }, "private": { "type": "boolean" }, "html_url": { "type": "string" }, "clone_url": { "type": "string" }, "ssh_url": { "type": "string" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "default_branch": { "type": "string" }, "visibility": { "type": "string" }, "fork": { "type": "boolean" }, "owner": { "type": "object", "properties": { "id": { "type": "integer" }, "login": { "type": "string" }, "avatar_url": { "type": "string" }, "html_url": { "type": "string" }, "type": { "type": "string" } }, "additionalProperties": true } }, "additionalProperties": true }, "nullable": false, "handle": "repo2" }, { "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Dev.to article record." }, "nullable": false, "handle": "article" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "checked_at" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "repo1" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "repo2" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "article1" } ], "name": "Compile engagement", "moduleId": "n_0fe47423df08222a", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_e3b262307f2f74e3": { "name": "Engagement summary", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "checked_at" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "repo1" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "repo2" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "article1" } ], "outputMappings": { "checked_at": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ed02b99b2d628dad", "output": "checked_at" } ] }, "repo1": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ed02b99b2d628dad", "output": "repo1" } ] }, "repo2": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ed02b99b2d628dad", "output": "repo2" } ] }, "article1": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ed02b99b2d628dad", "output": "article1" } ] } } } }, "edges": [ { "source": "n_ffaf18c47ef103fc", "target": "n_5f1e3b8d8d1298f0" }, { "source": "n_5f1e3b8d8d1298f0", "target": "n_ff211007578eb968" }, { "source": "n_ff211007578eb968", "target": "n_7b366a8376777ba3" }, { "source": "n_7b366a8376777ba3", "target": "n_ed02b99b2d628dad" }, { "source": "n_ed02b99b2d628dad", "target": "n_e3b262307f2f74e3" } ] } }, "modules": { "n_0fe47423df08222a": { "name": "Compile engagement", "imports": [], "source": "export default ({ repo1, repo2, article }) => {\n function metric(record, field, label) {\n if (record === null || typeof record !== 'object' || !Number.isFinite(record[field])) {\n throw new Error('Missing or invalid metric: ' + label + '.' + field);\n }\n return record[field];\n }\n function repository(record, label) {\n return {\n stars: metric(record, 'stargazers_count', label),\n forks: metric(record, 'forks_count', label),\n open_issues: metric(record, 'open_issues_count', label),\n };\n }\n return {\n checked_at: new Date().toISOString(),\n repo1: repository(repo1, 'repo1'),\n repo2: repository(repo2, 'repo2'),\n article1: {\n reactions: metric(article, 'positive_reactions_count', 'article'),\n comments: metric(article, 'comments_count', 'article'),\n },\n };\n};\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }