From 7bfb7a8cbcd75b2122bb94015771a3462870eb11 Mon Sep 17 00:00:00 2001 From: "lhq01844380@antgroup.com" Date: Thu, 22 Feb 2024 15:14:28 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8DGitHub=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9A=84keyword=E5=92=8Cowner=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/issue_scanner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service/issue_scanner.js b/src/service/issue_scanner.js index 7f5247e..db1e110 100644 --- a/src/service/issue_scanner.js +++ b/src/service/issue_scanner.js @@ -188,7 +188,7 @@ const issueScanner = { resultsArray = resultsArray.filter(res => res.duration != null && res.duration < config.generalConfig.dangerousIssuesConfig.mustReplyInXDays) if (resultsArray.length > 0) { resultsArray.forEach((result) => { - dangerousIssueDAO.insert(result.duration, result.project, result.title, result.url, result.keyword); + dangerousIssueDAO.insert(result.duration, result.project, result.title, result.url, owner); }); } else { dangerousIssueDAO.insert(null, null, null, null, owner) From e686333206c4e098d5bcb46216d5f581b20888ae Mon Sep 17 00:00:00 2001 From: liuhq <45447608+15669072513@users.noreply.github.com> Date: Thu, 22 Feb 2024 15:18:38 +0800 Subject: [PATCH 02/13] Update issue_scanner.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit github keywork和owner不一致的bug --- src/service/issue_scanner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service/issue_scanner.js b/src/service/issue_scanner.js index 7f5247e..db1e110 100644 --- a/src/service/issue_scanner.js +++ b/src/service/issue_scanner.js @@ -188,7 +188,7 @@ const issueScanner = { resultsArray = resultsArray.filter(res => res.duration != null && res.duration < config.generalConfig.dangerousIssuesConfig.mustReplyInXDays) if (resultsArray.length > 0) { resultsArray.forEach((result) => { - dangerousIssueDAO.insert(result.duration, result.project, result.title, result.url, result.keyword); + dangerousIssueDAO.insert(result.duration, result.project, result.title, result.url, owner); }); } else { dangerousIssueDAO.insert(null, null, null, null, owner) From b4ac39892e69d97743f076c3ea9f850b12dd75be Mon Sep 17 00:00:00 2001 From: "lhq01844380@antgroup.com" Date: Mon, 26 Feb 2024 11:15:33 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8DGitHub=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9A=84keyword=E5=92=8Cowner=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scan_dev.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scan_dev.js b/src/scan_dev.js index c6ea6a3..5303c7b 100644 --- a/src/scan_dev.js +++ b/src/scan_dev.js @@ -19,7 +19,7 @@ dispatch(config,since, to); function devForTest(env,config) { if(env==='dev'){ const dev = require("../configs/config-dev.json"); - // config.generalConfig.mysqlConfig= {} + config.generalConfig.mysqlConfig= {} config.generalConfig.dingTalkGroupConfig=dev.dingTalkGroupConfig config.generalConfig['good-first-issue-notifier']=dev['good-first-issue-notifier'] for (const owner in config.orgRepoConfig) { From f236371b460738bfdae5cfbde8c5b26a7bad2728 Mon Sep 17 00:00:00 2001 From: "lhq01844380@antgroup.com" Date: Mon, 26 Feb 2024 15:43:24 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E9=A3=9E=E4=B9=A6?= =?UTF-8?q?=E7=9A=84=E6=8A=BD=E8=B1=A1=E6=95=B4=E7=90=86=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/dangerous_issue.js | 188 ++--------------------------------- src/dao/dingtalk.js | 132 ++++++++---------------- src/dao/im.js | 124 +++++++++++++++++++++++ src/dao/otherim.js | 17 ++++ src/metrics/issues.js | 4 - src/notify.js | 4 +- src/scan_prod.js | 6 +- src/service/issue_scanner.js | 24 +---- 8 files changed, 200 insertions(+), 299 deletions(-) create mode 100644 src/dao/im.js create mode 100644 src/dao/otherim.js diff --git a/src/dao/dangerous_issue.js b/src/dao/dangerous_issue.js index 49a42c9..1f80382 100644 --- a/src/dao/dangerous_issue.js +++ b/src/dao/dangerous_issue.js @@ -1,9 +1,8 @@ const fs = require("fs"); -const moment = require("moment"); -const fetch = require("node-fetch"); const config = require("../../configs/config.json"); const {getConfig} = require("../const"); const { getConn, query } = require("./mysql_conn"); +const { getImDao } = require("./im"); const {utils} = require("../utils/time_utils"); const mysqlDao = { @@ -45,7 +44,6 @@ const mysqlDao = { const dingTalkDao = { issuesForDingTalk: new Map(), - livenessCheck: new Map(), start: function () { }, // put the issue into the memory list @@ -78,7 +76,7 @@ const dingTalkDao = { sendLiveness:async function(livenessCheckElement,owner,ownerDingTalkGroupConfig){ if (livenessCheckElement > 0) { let livenessContent = this.concatLivenessContent(owner, livenessCheckElement, ownerDingTalkGroupConfig); - await this.send(livenessContent, null, false, true, "liveness", ownerDingTalkGroupConfig); + await getImDao.send(livenessContent, null, false, true, "liveness", ownerDingTalkGroupConfig); } else { await this.sendSuccessLivecheck(owner, ownerDingTalkGroupConfig) } @@ -91,7 +89,7 @@ const dingTalkDao = { const ownerDingTalkGroupConfig = getConfig(null, config.orgRepoConfig[owner]['dingTalkGroupConfig'], config.generalConfig['dingTalkGroupConfig']); if (value.length > 0) { let issueContent = this.concatIssueContent(owner, value, ownerDingTalkGroupConfig); - await this.send(issueContent, null, false, true, "issue", ownerDingTalkGroupConfig); + await getImDao().send(issueContent, null, false, true, "issue", ownerDingTalkGroupConfig); } else { await this.sendNoIssue(owner, ownerDingTalkGroupConfig) } @@ -209,7 +207,7 @@ const dingTalkDao = { `注:liveness check会检查每个项目的健康情况,如果满足下列条件会被归类为“腐烂级”项目:\n` + `- 存在大于30天未回复的 issue \n` + `- 连续4周活跃度小于20\n`; - await this.send(content, null, false, false, "liveness", dingTalkGroupConfig); + await getImDao().send(content, null, false, false, "liveness", dingTalkGroupConfig); }, sendNoIssue: async function (owner, dingTalkGroupConfig) { let awards = [ @@ -234,178 +232,10 @@ const dingTalkDao = { let idx = Math.floor(Math.random() * awards.length); let content = awards[idx].content; let img = awards[idx].img; - await this.send(content, null, false, false, "issue", dingTalkGroupConfig); - await this.sendImage(img, null, false, false, "issue", owner, dingTalkGroupConfig); - }, - /** - * 这里的owner等于owner好像 - * @param content - * @param atUid - * @param isAtAll - * @param isNegative - * @param topicType - * @param dingTalkGroupConfig - */ - send: async function (content, atUid, isAtAll, isNegative, topicType,dingTalkGroupConfig) { - const topicTypeLiveness = "liveness"; - const topicTypeIssue = "issue"; - const groups = dingTalkGroupConfig["groups"] - - for (let group of groups) { - // 1.validate - // 检查url是否为空 - if (group['url'] == null || group['url'].length === 0) { - console.log("DingTalk url is empty"); - continue; - } - // check topic projects - // 检查group.topicProjects中是否包含project - // if (!this.interested(group['topicProjects'], project)) { - // continue; - // } - // check topicTypesIgnore - // 检查group['topicTypesIgnore']是否为*或者是否等于topicType - if (this.isIgnoredTopicType(group['topicTypesIgnore'], topicType)) { - continue; - } - // check topicTypesOnly - // 检查group['topicTypesOnly']是否为*或者是否等于topicType - if (!this.interestedTopicType(group['topicTypesOnly'], topicType)) { - continue; - } - // check owner in content - // 检查content中是否有group.owner,没有则替换this.owner - let newContent = content; + await getImDao().send(content, null, false, false, "issue", dingTalkGroupConfig); + await getImDao().sendImage(img, null, false, false, "issue", owner, dingTalkGroupConfig); + } - // append text - // 添加链接文本 - if (topicType === topicTypeIssue) { - if (isNegative) { - newContent += this.nullToEmpty(group['issueWarningText']); - } else { - //没有issue,不会发消息,这个实际没有用到 - newContent += this.nullToEmpty(group['issueCongratulationText']); - } - } else if (topicType === topicTypeLiveness) { - if (isNegative) { - newContent += this.nullToEmpty(group['livenessWarningText']); - } else { - newContent += this.nullToEmpty(group['livenessCongratulationText']); - } - } - let uidArr = []; - if (atUid != null) { - uidArr = atUid; - } - // 2. send request - //发送请求 - return fetch(group.url, { - method: "POST", - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - body: JSON.stringify({ - at: { - atMobiles: [""], - atUserIds: uidArr, - isAtAll: isAtAll, - }, - text: { - content: newContent, - }, - msgtype: "text", - title: ``, - }), - }) - // 3. parse - .then((res) => { - return res.json(); - }) - .then((json) => { - console.log( `发送钉钉:${newContent}结果:`) - console.log(json) - }); - } - }, - nullToEmpty(str) { - // 如果str为null,则返回空字符串 - if (str == null) { - return ""; - } - // 否则返回str - return str; - }, - interested: function (topicProjects, project) { - // 如果topicProjects为空或者长度为0或者topicProjects为* - if ( - topicProjects == null || - topicProjects.length == 0 || - topicProjects == "*" - ) { - // 返回true - return true; - } - // 如果topicProjects中包含project - if (topicProjects.indexOf(project) >= 0) { - // 返回true - return true; - } - // 否则返回false - return false; - }, - sendImage: async function (imageUrl, atUid, isAtAll, isNegative, topicType,owner,option) { - const groups = option["groups"] - for (let group of groups) { - // 1.validate - if (group.url == null || group.url.length == 0) { - console.log("send image:DingTalk url is empty"); - continue; - } - // check topic project - // if (!this.interested(group['topicProjects'], project)) { - // continue; - // } - // check topicTypesIgnore - if (this.isIgnoredTopicType(group['topicTypesIgnore'], topicType)) { - continue; - } - // check topicTypesOnly - if (!this.interestedTopicType(group['topicTypesOnly'], topicType)) { - continue; - } - // check owner in content - let nickName = owner; - if (group['nickName'] != null) { - nickName = group['nickName']; - } - // 2. send request - return fetch(group.url, { - method: "POST", - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - body: JSON.stringify({ - msgtype: "markdown", - markdown: { - title: nickName, - text: `![](${imageUrl}) \n`, - }, - at: { - atMobiles: [""], - atUserIds: [atUid], - isAtAll: isAtAll, - }, - }), - }) - // 3. parse - .then((res) => { - return res.json(); - }) - .then((json) => console.log("发送图片结果:",json)); - } - }, }; const fsDAOImpl = { @@ -492,9 +322,7 @@ module.exports = { fsDAOImpl.commit(); dingTalkDao.commit(); }, - getDingTalkDao() { - return dingTalkDao; - }, + getMysqlDao(){ return mysqlDao; } diff --git a/src/dao/dingtalk.js b/src/dao/dingtalk.js index 0df8207..e2d6d0f 100644 --- a/src/dao/dingtalk.js +++ b/src/dao/dingtalk.js @@ -1,110 +1,64 @@ const fetch = require("node-fetch"); - -// https://open.dingtalk.com/document/group/custom-robot-access -const dingTalkDao = { - // 发送消息 - send: function (groupUrls, content, title, atUid, isAtAll) { - // 遍历groupUrls数组 - for (let group of groupUrls) { - // 1.validate - // 判断groupUrls数组是否为空 - if (group == null || group.length == 0) { - console.log("DingTalk groupUrls is empty"); - continue; - } - let uidArr = []; - if (atUid != null) { - uidArr = atUid; - } - // 2. send request - // 发送请求 - fetch(group, { +//钉钉发送client +const dingtalk = { + send : function send(group, newContent, uidArr, isAtAll) { + return fetch(group.url, { method: "POST", headers: { - "Content-Type": "application/json", - Accept: "application/json", + "Content-Type": "application/json", + Accept: "application/json", }, body: JSON.stringify({ - at: { - atMobiles: [""], - atUserIds: uidArr, - isAtAll: isAtAll, - }, - text: { - content: content, - }, - msgtype: "text", - title: `${title}`, + at: { + atMobiles: [""], + atUserIds: uidArr, + isAtAll: isAtAll, + }, + text: { + content: newContent, + }, + msgtype: "text" }), - }) - // 3. parse + }) .then((res) => { - return res.json(); + return res.json(); }) - .then((json) => console.log(json)); - } - }, + .then((json) => { + console.log( `发送IM:${newContent}结果:`); + console.log(json); + }); +}, - // 发送markdown消息 - sendMarkdown: function (groupUrls, content, title, atUid, isAtAll) { - // 遍历groupUrls数组 - for (let group of groupUrls) { - // 1.validate - // 判断groupUrls数组是否为空 - if (group == null || group.length == 0) { - console.log("DingTalk groupUrls is empty"); - continue; - } - let uidArr = []; - if (atUid != null) { - uidArr = atUid; - } - // 2. send request - // 发送请求 - fetch(group, { + sendMarkdown :function sendMarkdown(group, nickName, imageUrl, atUid, isAtAll) { + // 2. send request + fetch(group.url, { method: "POST", headers: { - "Content-Type": "application/json", - Accept: "application/json", + "Content-Type": "application/json", + Accept: "application/json", }, body: JSON.stringify({ - msgtype: "markdown", - markdown: { - title: `${title}`, - text: content, - }, - at: { - atMobiles: [""], - atUserIds: uidArr, - isAtAll: isAtAll, - }, + msgtype: "markdown", + markdown: { + title: nickName+" issue", + text: `![](${imageUrl}) \n`, + }, + at: { + atMobiles: [""], + atUserIds: [atUid], + isAtAll: isAtAll, + }, }), - }) + }) // 3. parse .then((res) => { - return res.json(); + return res.json(); }) - .then((json) => console.log(json)); - } - }, - // 将null转换为空字符串 - nullToEmpty(str) { - if (str == null) { - return ""; - } - return str; - }, + .then((json) => console.log("发送图片结果:", json)); +} }; + module.exports = { - // 发送消息 - send: function (groupUrls, content, title, atUid, isAtAll) { - // 调用dingTalkDao的send方法,发送消息 - return dingTalkDao.send(groupUrls, content, title, atUid, isAtAll); - }, - // 发送markdown消息 - sendMarkdown: function (groupUrls, content, title, atUid, isAtAll) { - // 调用dingTalkDao的sendMarkdown方法,发送markdown消息 - return dingTalkDao.sendMarkdown(groupUrls, content, title, atUid, isAtAll); - }, + dingtalk:dingtalk }; \ No newline at end of file diff --git a/src/dao/im.js b/src/dao/im.js new file mode 100644 index 0000000..2f516d7 --- /dev/null +++ b/src/dao/im.js @@ -0,0 +1,124 @@ + +const {dingtalk} = require("./dingtalk"); +const {otherim} = require("./otherim"); +// https://open.dingtalk.com/document/group/custom-robot-access +const imDao = { + + // 发送markdown消息 + sendMarkdown: function (groupUrls, content, title, atUid, isAtAll) { + // 遍历groupUrls数组 + for (let group of groupUrls) { + // 1.validate + // 判断groupUrls数组是否为空 + if (group == null || group.length == 0) { + console.log("DingTalk groupUrls is empty"); + continue; + } + let uidArr = []; + if (atUid != null) { + uidArr = atUid; + } + + if(group['type']==='dingtalk'){ + return dingtalk.sendMarkdown(group,content,atUid,uidArr); + }else{ + ///// 其他IM接入示例 + return otherim.sendMarkdown(group,content,atUid,uidArr); + } + + } + }, + /** + * 这里的owner等于owner好像 + * @param content + * @param atUid + * @param isAtAll + * @param isNegative + * @param topicType + * @param dingTalkGroupConfig + */ + send: async function (content, atUid, isAtAll, isNegative, topicType,dingTalkGroupConfig) { + const topicTypeLiveness = "liveness"; + const topicTypeIssue = "issue"; + const groups = dingTalkGroupConfig["groups"] + + for (let group of groups) { + + // 1.validate + // 检查url是否为空 + if (group['url'] == null || group['url'].length === 0) { + console.log("DingTalk url is empty"); + continue; + } + + // check owner in content + // 检查content中是否有group.owner,没有则替换this.owner + let newContent = content; + + // append text + // 添加链接文本 + if (topicType === topicTypeIssue) { + if (isNegative) { + newContent += nullToEmpty(group['issueWarningText']); + } else { + //没有issue,不会发消息,这个实际没有用到 + newContent += nullToEmpty(group['issueCongratulationText']); + } + } else if (topicType === topicTypeLiveness) { + if (isNegative) { + newContent += nullToEmpty(group['livenessWarningText']); + } else { + newContent += nullToEmpty(group['livenessCongratulationText']); + } + } + let uidArr = []; + if (atUid != null) { + uidArr = atUid; + } + if(group['type'] === 'dingtalk'){ + return dingtalk.send(group,content,atUid,uidArr); + }else{ + // + } + + } + }, + + sendImage: async function (imageUrl, atUid, isAtAll, isNegative, topicType,owner,option) { + const groups = option["groups"] + for (let group of groups) { + // 1.validate + if (group.url == null || group.url.length == 0) { + console.log("send image:DingTalk url is empty"); + continue; + } + + // check owner in content + let nickName = owner; + if (group['nickName'] != null) { + nickName = group['nickName']; + } + if(group['type'] === 'dingtalk'){ + return dingtalk.sendMarkdown(group,nickName,imageUrl,atUid,isAtAll); + }else{ + // + } + } + } +}; + + function nullToEmpty(str) { + // 如果str为null,则返回空字符串 + if (str == null) { + return ""; + } + // 否则返回str + return str; + } + + +module.exports = { + getImDao() { + return imDao; + } +}; \ No newline at end of file diff --git a/src/dao/otherim.js b/src/dao/otherim.js new file mode 100644 index 0000000..7012a7c --- /dev/null +++ b/src/dao/otherim.js @@ -0,0 +1,17 @@ +const fetch = require("node-fetch"); +//其他IM发送client + +const otherim = { + send : function (group, newContent, uidArr, isAtAll) { +}, + +sendMarkdown : function (group,title,content,uidArr,isAtAll){ +} +}; + + +module.exports = { + otherim() { + return otherim; + } +}; \ No newline at end of file diff --git a/src/metrics/issues.js b/src/metrics/issues.js index a2285a1..6a20526 100644 --- a/src/metrics/issues.js +++ b/src/metrics/issues.js @@ -279,10 +279,6 @@ function filterOutDangerousIssues(issues, to,owner,repo) { // 判断issue是否早30天创建,如果是则直接返回 // check baseline let createDay = moment(issue.createdAt, "YYYY-MM-DDTHH:mm:ssZ"); - // const baseline = moment().subtract(mustReplyInXDays,'days') - // if (baseline != null && baseline.isAfter(createDay)) { - // return; - // } // check duration let duration = moment(to).diff(createDay, "day"); issue.duration = duration; diff --git a/src/notify.js b/src/notify.js index c0037ec..19e743e 100644 --- a/src/notify.js +++ b/src/notify.js @@ -1,6 +1,6 @@ -const sender = require("./dao/dingtalk"); +const sender = require("./dao/im"); -sender.sendMarkdown( +sender.getImDao().sendMarkdown( [ // The webhook url of your dingtalk bot. For example: "https://oapi.dingtalk.com/robot/send?access_token=111111", diff --git a/src/scan_prod.js b/src/scan_prod.js index 4707eb7..a6a4531 100644 --- a/src/scan_prod.js +++ b/src/scan_prod.js @@ -3,11 +3,13 @@ const { dispatch } = require("./dispatcher"); //一个config配置文件,用户私有仓库配置,我们手动复制到放在服务器上面 const config = require("../configs/config.json"); const { configNames } = require("./const.js"); +const moment = require("moment/moment"); // 2. Time range. -let since = utils.sevenDaysBefore(); -let to = utils.today(); +// let since = utils.sevenDaysBefore(); +let since = moment().subtract(16, "days").toISOString(true); +let to = utils.today() //需要改的配置 const env = "prod"; diff --git a/src/service/issue_scanner.js b/src/service/issue_scanner.js index db1e110..6c63762 100644 --- a/src/service/issue_scanner.js +++ b/src/service/issue_scanner.js @@ -4,7 +4,7 @@ const { } = require("../metrics/issues"); const dangerousIssueDAO = require("../dao/dangerous_issue"); const { weeklyScoreDAO } = require("../dao/weekly_score"); -const sender = require("../dao/dingtalk"); +const sender = require("../dao/im"); const { configNames,getConfig } = require("../const.js"); /** @@ -62,27 +62,7 @@ const issueScanner = { // 扫描仓库中的 good first issue const res = listGoodFirstIssues(config.generalConfig.graphToken, owner, repo, since) .then(async function (issues) { - // The data structure looks like: - // { - // easy: [], - // medium: [ - // { - // project: 'layotto', - // title: 'Develop a new component for sms API; 为"短信 API" 开发新的组件', - // url: 'https://github.com/mosn/layotto/issues/830', - // labels: [Array] - // } - // ], - // hard: [ - // { - // project: 'layotto', - // title: 'generate a cli tool for Layotto; 生成 Layotto 命令行工具', - // url: 'https://github.com/mosn/layotto/issues/826', - // labels: [Array] - // } - // ], - // unknown: [] - // } + let text = `${owner}社区${repo}项目新增了几个 good first issue, 欢迎感兴趣的朋友认领! \n\r`; From fd0357f922d264cca82ffc237eefef2a8c61147d Mon Sep 17 00:00:00 2001 From: "lhq01844380@antgroup.com" Date: Mon, 26 Feb 2024 11:15:33 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8DGitHub=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9A=84keyword=E5=92=8Cowner=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scan_dev.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scan_dev.js b/src/scan_dev.js index c6ea6a3..5303c7b 100644 --- a/src/scan_dev.js +++ b/src/scan_dev.js @@ -19,7 +19,7 @@ dispatch(config,since, to); function devForTest(env,config) { if(env==='dev'){ const dev = require("../configs/config-dev.json"); - // config.generalConfig.mysqlConfig= {} + config.generalConfig.mysqlConfig= {} config.generalConfig.dingTalkGroupConfig=dev.dingTalkGroupConfig config.generalConfig['good-first-issue-notifier']=dev['good-first-issue-notifier'] for (const owner in config.orgRepoConfig) { From 9915636c0f1d255fb13b973f9dc0878a15156268 Mon Sep 17 00:00:00 2001 From: "lhq01844380@antgroup.com" Date: Mon, 4 Mar 2024 14:11:25 +0800 Subject: [PATCH 06/13] =?UTF-8?q?1,dangerous=20issue=20=E5=8E=BB=E6=8E=89c?= =?UTF-8?q?ollaborator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/metrics/issues.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metrics/issues.js b/src/metrics/issues.js index 6a20526..19f81fa 100644 --- a/src/metrics/issues.js +++ b/src/metrics/issues.js @@ -333,7 +333,7 @@ function withSpecialLabels(issue) { function isCommunityIssue_graphql(issue) { // 判断issue的authorAssociation是否不是MEMBER和OWNER return ( - issue.authorAssociation != "MEMBER" && issue.authorAssociation != "OWNER" + issue.authorAssociation != "MEMBER" && issue.authorAssociation != "OWNER" && issue.authorAssociation != "COLLABORATOR" ); } From 214dc077dded20d1e8c09ffcc8902847d5712b0f Mon Sep 17 00:00:00 2001 From: liuhq <45447608+15669072513@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:04:22 +0800 Subject: [PATCH 07/13] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 81380ad..3f5b399 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,11 @@ issue 被 assign 后,在 IM 群中提醒当事人。 详见 https://github.com/mosn/layotto/issues/800 如果开启该功能,good first issue 必须满足一定的label 规范、命名规范, 详见 https://mosn.io/layotto/#/zh/development/label-spec +### 7. 接入其他IM + +- 代码:仿照dingtalk.js编写自己的xxxim.js,然后把自己的xxxim.js在src/dao/im.js里面导入。在接口里面根据im的配置type在if分支里面调用自己写的接口。 +- 配置:在config.json里面填写im的type为自己的im类型。 + ## 使用文档 - [如何在钉钉群里添加“项目管理机器人”](pm_bot.md) @@ -145,4 +150,4 @@ issue 被 assign 后,在 IM 群中提醒当事人。 ## Roadmap -见 issue 区 \ No newline at end of file +见 issue 区 From 9aa7ed28426f81a9c6a5ffc8558dacc4b763302b Mon Sep 17 00:00:00 2001 From: liuhq <45447608+15669072513@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:08:23 +0800 Subject: [PATCH 08/13] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 3f5b399..60110a3 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,13 @@ issue 被 assign 后,在 IM 群中提醒当事人。 ### 7. 接入其他IM - 代码:仿照dingtalk.js编写自己的xxxim.js,然后把自己的xxxim.js在src/dao/im.js里面导入。在接口里面根据im的配置type在if分支里面调用自己写的接口。 + - 配置:在config.json里面填写im的type为自己的im类型。 ## 使用文档 From 24597c227fb88feb038c8da3a7abcf81612c2fdd Mon Sep 17 00:00:00 2001 From: liuhq <45447608+15669072513@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:10:13 +0800 Subject: [PATCH 09/13] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 60110a3..2e7ed23 100644 --- a/README.md +++ b/README.md @@ -127,13 +127,13 @@ issue 被 assign 后,在 IM 群中提醒当事人。 ### 7. 接入其他IM - 代码:仿照dingtalk.js编写自己的xxxim.js,然后把自己的xxxim.js在src/dao/im.js里面导入。在接口里面根据im的配置type在if分支里面调用自己写的接口。 - +` - 配置:在config.json里面填写im的type为自己的im类型。 ## 使用文档 From a701365cc9c63f003a98a3389edced701cf98505 Mon Sep 17 00:00:00 2001 From: liuhq <45447608+15669072513@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:11:55 +0800 Subject: [PATCH 10/13] Update README.md --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e7ed23..f7e0ff6 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,8 @@ issue 被 assign 后,在 IM 群中提醒当事人。 ### 7. 接入其他IM - 代码:仿照dingtalk.js编写自己的xxxim.js,然后把自己的xxxim.js在src/dao/im.js里面导入。在接口里面根据im的配置type在if分支里面调用自己写的接口。 - ` if(group['type']==='dingtalk'){ + ` + if(group['type']==='dingtalk'){ return dingtalk.sendMarkdown(group,content,atUid,uidArr); }else{ ///// 其他IM接入示例 @@ -135,6 +136,22 @@ issue 被 assign 后,在 IM 群中提醒当事人。 } ` - 配置:在config.json里面填写im的type为自己的im类型。 + ` + "good-first-issue-notifier": { + "enable": true, + "channels": [ + { + "type": "yourim", + "urls": [ + "https://oapi.dingtalk.com/robot/send?access_token=66113ea1b10247d25149158fb4b765da6c3c57bddca2682215122cc205e2ac70" + ], + "title": "goodFirstIssue认领", + "atUid": [], + "atAll": true + } + ] + } + ` ## 使用文档 From 3805195cc66d400756aa59a5e3066c4a13ee46fb Mon Sep 17 00:00:00 2001 From: liuhq <45447608+15669072513@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:12:40 +0800 Subject: [PATCH 11/13] Update README.md --- README.md | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/README.md b/README.md index f7e0ff6..89a3137 100644 --- a/README.md +++ b/README.md @@ -127,32 +127,8 @@ issue 被 assign 后,在 IM 群中提醒当事人。 ### 7. 接入其他IM - 代码:仿照dingtalk.js编写自己的xxxim.js,然后把自己的xxxim.js在src/dao/im.js里面导入。在接口里面根据im的配置type在if分支里面调用自己写的接口。 - ` - if(group['type']==='dingtalk'){ - return dingtalk.sendMarkdown(group,content,atUid,uidArr); - }else{ - ///// 其他IM接入示例 - return otherim.sendMarkdown(group,content,atUid,uidArr); - } -` - 配置:在config.json里面填写im的type为自己的im类型。 - ` - "good-first-issue-notifier": { - "enable": true, - "channels": [ - { - "type": "yourim", - "urls": [ - "https://oapi.dingtalk.com/robot/send?access_token=66113ea1b10247d25149158fb4b765da6c3c57bddca2682215122cc205e2ac70" - ], - "title": "goodFirstIssue认领", - "atUid": [], - "atAll": true - } - ] - } - ` - + ## 使用文档 - [如何在钉钉群里添加“项目管理机器人”](pm_bot.md) From c22fc8ff50d05089be7e54fe8ea78de0795f1f2f Mon Sep 17 00:00:00 2001 From: liuhq <45447608+15669072513@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:13:23 +0800 Subject: [PATCH 12/13] Update README.md --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 89a3137..259ec9c 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,29 @@ issue 被 assign 后,在 IM 群中提醒当事人。 ### 7. 接入其他IM - 代码:仿照dingtalk.js编写自己的xxxim.js,然后把自己的xxxim.js在src/dao/im.js里面导入。在接口里面根据im的配置type在if分支里面调用自己写的接口。 +- ` if(group['type']==='dingtalk'){ + return dingtalk.sendMarkdown(group,content,atUid,uidArr); + }else{ + ///// 其他IM接入示例 + return otherim.sendMarkdown(group,content,atUid,uidArr); + }` - 配置:在config.json里面填写im的type为自己的im类型。 +- ` + "good-first-issue-notifier": { + "enable": true, + "channels": [ + { + "type": "dingtalk", + "urls": [ + "https://oapi.dingtalk.com/robot/send?access_token=66113ea1b10247d25149158fb4b765da6c3c57bddca2682215122cc205e2ac70" + ], + "title": "goodFirstIssue认领", + "atUid": [], + "atAll": true + } + ] + } +- ` ## 使用文档 From d34aec7ab26a94157391e01298795f7add4152cd Mon Sep 17 00:00:00 2001 From: liuhq <45447608+15669072513@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:13:49 +0800 Subject: [PATCH 13/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 259ec9c..9151afd 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ issue 被 assign 后,在 IM 群中提醒当事人。 } ] } -- ` + ` ## 使用文档