You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2020/10/28 01:02:26 UTC
[incubator-echarts-bot] 31/32: feat: add "PR: awaiting doc" label
if doc changed
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-bot.git
commit 721cb2eb6f32f109402d7295476bc0a7a2958c91
Author: Ovilia <zw...@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-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org