From 6ab5258b7ff1fa40626bb37ef94c1e1bb2621099 Mon Sep 17 00:00:00 2001 From: "ubiquity-os-beta[bot]" <182769649+ubiquity-os-beta[bot]@users.noreply.github.com> Date: Sun, 16 Feb 2025 22:59:58 +0000 Subject: [PATCH] chore: updated manifest.json and dist build --- dist/index.js | 90 +++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/dist/index.js b/dist/index.js index 43bf2ad..335b8d0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31464,61 +31464,59 @@ async function createPullRequest({ payload: e, logger: t, userOctokit: r, userNa await r.rest.git.updateRef({ owner: s, repo: i, ref: `heads/${g}`, sha: E.sha }); return await r.rest.pulls.create({ owner: n, repo: o, head: `${s}:${g}`, base: u, body: `Resolves #${A}`, title: g }); } -async function handleComment(e) { - const { eventName: t, payload: r, logger: s, octokit: o, userName: A, userOctokit: n } = e; - const i = r.comment.body; - const a = r.repository.name; - const c = r.repository.owner.login; - const u = r.issue.number; - if (i.trim().startsWith("/demo")) { +async function handleCommentCreated(e) { + const { payload: t, logger: r, octokit: s, userName: o, userOctokit: A } = e; + const n = t.comment.body; + const i = t.repository.name; + const a = t.repository.owner.login; + const c = t.issue.number; + if (n.trim().startsWith("/demo")) { if (!(await isUserAdmin(e))) { - throw s.error("You do not have admin privileges thus cannot start a demo."); + throw r.error("You do not have admin privileges thus cannot start a demo."); } - s.info("Processing /demo command"); + r.info("Processing /demo command"); await openIssue(e); - await setLabels(e); - } else if (i.includes("ubiquity-os-command-start-stop") && i.includes(A)) { - s.info("Processing ubiquity-os-command-start-stop post comment"); + await handleInit(e); + } else if (n.includes("ubiquity-os-command-start-stop") && n.includes(o)) { + r.info("Processing ubiquity-os-command-start-stop post comment"); const t = await createPullRequest(e); - await o.rest.pulls.merge({ owner: c, repo: a, pull_number: t.data.number }); - } else if (i.includes("ubiquity-os-command-wallet") && i.includes(A)) { - await n.rest.issues.createComment({ - owner: c, - repo: a, - issue_number: u, + await s.rest.pulls.merge({ owner: a, repo: i, pull_number: t.data.number }); + } else if (n.includes("ubiquity-os-command-wallet") && n.includes(o)) { + await A.rest.issues.createComment({ + owner: a, + repo: i, + issue_number: c, body: `Now I can self assign to this task!\n\nWe have a built-in command called \`/start\` which also does some other checks before assignment, including seeing how saturated we are with other open GitHub issues now. This ensures that contributors don't "bite off more than they can chew."\n\nThis feature is especially useful for our open source partners who want to attract talent from around the world to contribute, without having to manually assign them before starting. \n\nWhen pricing is set on any GitHub Issue, they will be automatically populated in our [DevPool Directory](https://devpool.directory) making it easy for contributors to discover and join new projects.`, }); - await n.rest.issues.createComment({ owner: c, repo: a, issue_number: u, body: `/start` }); - } else if (t === "issue_comment.edited" && i.includes("ubiquity-os-marketplace/text-conversation-rewards")) { + await A.rest.issues.createComment({ owner: a, repo: i, issue_number: c, body: `/start` }); } } -async function handleLabel(e) { +async function handleCommentEdited(e) { + const { eventName: t, payload: r } = e; + const s = r.comment.body; + if (t === "issue_comment.edited" && s.includes("ubiquity-os-marketplace/text-conversation-rewards")) { + } +} +async function handleInit(e) { const { payload: t, userOctokit: r, logger: s } = e; const o = t.repository.name; const A = t.issue.number; const n = t.repository.owner.login; - const i = t.label; - if (i?.name.startsWith("Price") && RegExp(/ubiquity-os-demo\s*/).test(o)) { - s.info("Handle pricing label set", { label: i }); - await r.rest.issues.createComment({ - owner: n, - repo: o, - issue_number: A, - body: `Hey there @${t.repository.owner.login}, and welcome! This interactive demo highlights how UbiquityOS streamlines development workflows. Here’s what you can expect:\n\n- All functions are installable from our @ubiquity-os-marketplace, letting you tailor your management configurations for any organization or repository.\n- We’ll walk you through key capabilities—AI-powered task matching, automated pricing calculations, and smart contract integration for payments.\n- Adjust settings globally across your org or use local repo overrides. More details on repository config can be found [here](https://github.com/0x4007/ubiquity-os-demo-kljiu/blob/development/.github/.ubiquity-os.config.yml).\n\n### Getting Started\n- Try out the commands you see. Feel free to experiment with different tasks and features.\n- Create a [new issue](new) at any time to reset and begin anew.\n- Use \`/help\` if you’d like to see additional commands.\n\nEnjoy the tour!`, - }); - await r.rest.issues.createComment({ - owner: n, - repo: o, - issue_number: A, - body: `The first step is for me to register my wallet address to collect rewards.`, - }); - await r.rest.issues.createComment({ owner: n, repo: o, issue_number: A, body: "/wallet 0xefC0e701A824943b469a694aC564Aa1efF7Ab7dd" }); - } else { - s.info("Ignoring label change", { label: i, assignee: t.issue.assignee, repo: o }); - } + s.info("Starting demo", { owner: n, repo: o, issueNumber: A }); + await r.rest.issues.createComment({ + owner: n, + repo: o, + issue_number: A, + body: `Hey there @${t.repository.owner.login}, and welcome! This interactive demo highlights how UbiquityOS streamlines development workflows. Here’s what you can expect:\n\n- All functions are installable from our @ubiquity-os-marketplace, letting you tailor your management configurations for any organization or repository.\n- We’ll walk you through key capabilities—AI-powered task matching, automated pricing calculations, and smart contract integration for payments.\n- Adjust settings globally across your org or use local repo overrides. More details on repository config can be found [here](https://github.com/0x4007/ubiquity-os-demo-kljiu/blob/development/.github/.ubiquity-os.config.yml).\n\n### Getting Started\n- Try out the commands you see. Feel free to experiment with different tasks and features.\n- Create a [new issue](new) at any time to reset and begin anew.\n- Use \`/help\` if you’d like to see additional commands.\n\nEnjoy the tour!`, + }); + await r.rest.issues.createComment({ owner: n, repo: o, issue_number: A, body: `The first step is for me to register my wallet address to collect rewards.` }); + await r.rest.issues.createComment({ owner: n, repo: o, issue_number: A, body: "/wallet 0xefC0e701A824943b469a694aC564Aa1efF7Ab7dd" }); +} +function isCommentCreatedEvent(e) { + return e.eventName === "issue_comment.created"; } -function isCommentEvent(e) { - return e.eventName === "issue_comment.created" || e.eventName === "issue_comment.edited"; +function isCommentEditedEvent(e) { + return e.eventName === "issue_comment.edited"; } function isLabelEvent(e) { return e.eventName === "issues.labeled"; @@ -31528,10 +31526,10 @@ async function runPlugin(e) { e.userOctokit = new kt({ auth: e.env.USER_GITHUB_TOKEN }); const { data: s } = await e.userOctokit.rest.users.getAuthenticated(); e.userName = s.login; - if (isCommentEvent(e)) { - return await handleComment(e); - } else if (isLabelEvent(e)) { - return await handleLabel(e); + if (isCommentCreatedEvent(e)) { + return await handleCommentCreated(e); + } else if (isCommentEditedEvent(e)) { + return await handleCommentEdited(e); } t.error(`Unsupported event: ${r}`); }