[Doc]Fix the double label problem caused by too fast operation (#24)
diff --git a/doc-label-check/dist/index.js b/doc-label-check/dist/index.js
index 85b8ccf..4463867 100644
--- a/doc-label-check/dist/index.js
+++ b/doc-label-check/dist/index.js
@@ -2588,10 +2588,11 @@
const labelsToAdd = labelsToProcess.filter(shouldAdd).map(labels_1.getName);
var issuelabels=utils_1.removeDuplicates(labelsToAdd.concat(labelsin));
- console.log(issuelabels);
- console.log(labelsToRemove);
- if(labelsToRemove.length!=0){
- issuelabels=issuelabels.filter((x)=>labelsToRemove.some((item=>x!=item)))}
+ var corrent=0
+ console.log(issuelabels);
+ console.log(labelsToRemove);
+ if(labelsToRemove.length!=0){
+ issuelabels=issuelabels.filter((x)=>labelsToRemove.some((item=>x!=item)))}
console.log("-----------------------");
console.log(issuelabels);
console.log("-----------------------");
@@ -2599,13 +2600,16 @@
var isdocmis=0
for(let index=0;index<Labels.length;index++){
if(issuelabels.includes(Labels[index])){
- console.log(Labels[index],"issue exists");
- if(Labels[index]=='doc-info-missing'){
- isdocmis=1
- }
+ console.log(Labels[index],"issue exists");
+ if(Labels[index]=='doc-info-missing'){
+ isdocmis=1
+ }
}else{
num=num+1
}
+ if(labelsToAdd.includes(Labels[index])){
+ corrent=1;
+ }
}
const errmessage="@"+user1+":Thanks for your contribution. For this PR, do we need to update docs?\n(The [PR template contains info about doc](https://github.com/apache/pulsar/blob/master/.github/PULL_REQUEST_TEMPLATE.md#documentation), which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)"
if(num==4 && isdocmis==0){
@@ -2645,6 +2649,14 @@
labels: labelsToAdd,
});
}
+ if(corrent==1){
+ yield octokit.issues.removeLabel({
+ owner,
+ repo,
+ issue_number,
+ name:"doc-info-missing"
+ })
+ }
});
}
function main() {