This is an automated email from the ASF dual-hosted git repository. ovilia pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-echarts-bot.git
The following commit(s) were added to refs/heads/master by this push: new 721cb2e feat: add "PR: awaiting doc" label if doc changed 721cb2e is described below commit 721cb2eb6f32f109402d7295476bc0a7a2958c91 Author: Ovilia <zwl.s...@gmail.com> AuthorDate: Mon Aug 31 13:47:54 2020 +0800 feat: add "PR: awaiting doc" label if doc changed --- index.js | 28 +++++++++++++++++++++++++--- src/text.js | 4 ++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 212df55..71e158e 100644 --- a/index.js +++ b/index.js @@ -91,14 +91,24 @@ module.exports = app => { app.on(['pull_request.opened'], async context => { // const auth = context.payload.pull_request.author_association; const isCore = isCoreCommitter(context.payload.pull_request.user.login); - const comment = context.github.issues.createComment(context.issue({ - body: isCore ? text.PR_OPENED_BY_COMMITTER : text.PR_OPENED - })); + let commentText = isCore + ? text.PR_OPENED_BY_COMMITTER + : text.PR_OPENED; const labelList = ['PR: awaiting review']; if (isCore) { labelList.push('PR: author is committer'); } + const content = context.payload.pull_request.body; + if (content && content.indexOf('[-] The API has been changed.') > -1) { + labelList.push('PR: awaiting doc'); + commentText += '\n\n' + text.PR_AWAITING_DOC; + } + + const comment = context.github.issues.createComment(context.issue({ + body: commentText + })); + const addLabel = context.github.issues.addLabels(context.issue({ labels: labelList })); @@ -106,6 +116,18 @@ module.exports = app => { return Promise.all([comment, addLabel]); }); + app.on(['pull_request.edited'], async context => { + const content = context.payload.pull_request.body; + if (content && content.indexOf('[-] The API has been changed.') > -1) { + return context.github.issues.addLabels(context.issue({ + labels: ['PR: awaiting doc'] + })); + } + else { + return getRemoveLabel(context, 'PR: awaiting doc'); + } + }); + app.on(['pull_request.synchronize'], async context => { const addLabel = context.github.issues.addLabels(context.issue({ labels: ['PR: awaiting review'] diff --git a/src/text.js b/src/text.js index 9d13778..8f0764b 100644 --- a/src/text.js +++ b/src/text.js @@ -54,6 +54,9 @@ const PR_OPENED_BY_COMMITTER = PR_OPENED + ` The pull request is marked to be \`PR: author is committer\` because you are a committer of this project.`; +const PR_AWAITING_DOC = `Document changes are required in this PR. Please also make a PR to [apache/incubator-echarts-doc](https://github.com/apache/incubator-echarts-doc) for document changes. When the doc PR is merged, the maintainers will remove the \`PR: awaiting doc\` label. +`; + const PR_MERGED = `Congratulations! Your PR has been merged. Thanks for your contribution! 👍`; @@ -86,6 +89,7 @@ module.exports = { PR_MERGED, PR_OPENED_BY_COMMITTER, PR_NOT_MERGED, + PR_AWAITING_DOC, ISSUE_TAGGED_WAITING_AUTHOR, ISSUE_TAGGED_EASY, ISSUE_TAGGED_PRIORITY_HIGH --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org