This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 80f77d1371 GH-36762: [Dev] Remove only component labels when an issue
is updated (#36763)
80f77d1371 is described below
commit 80f77d1371ef93c946b08c3c2a05d269c8548c74
Author: Jin Shang <[email protected]>
AuthorDate: Wed Jul 19 16:52:53 2023 +0800
GH-36762: [Dev] Remove only component labels when an issue is updated
(#36763)
### Rationale for this change
A follow-up of
https://github.com/apache/arrow/pull/36723#issuecomment-1640816772.
### What changes are included in this PR?
Non-component labels should be kept when the issue is updated.
### Are these changes tested?
It is tested on my fork. See https://github.com/js8544/arrow/issues/2
### Are there any user-facing changes?
No.
* Closes: #36762
Authored-by: Jin Shang <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
---
.github/workflows/issue_bot.yml | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/issue_bot.yml b/.github/workflows/issue_bot.yml
index 7a62f21496..ae344a4c1e 100644
--- a/.github/workflows/issue_bot.yml
+++ b/.github/workflows/issue_bot.yml
@@ -39,6 +39,20 @@ jobs:
let split_body = context.payload.issue.body.split('###
Component(s)');
if (split_body.length != 2) throw new Error('No components
found!');
+ let current_labels = await github.rest.issues.listLabelsOnIssue({
+ "owner": context.repo.owner,
+ "repo": context.repo.repo,
+ "per_page": 100,
+ "issue_number": context.payload.issue.number,
+ });
+
+ let current_label_names = current_labels.data.map(label =>
label.name);
+
+ // keep non-component labels
+ let non_component_labels = current_label_names.filter(
+ label => !label.startsWith("Component: ")
+ );
+
let component_labels = split_body[1]
.split(',')
.map(component => component.trim())
@@ -61,5 +75,5 @@ jobs:
"owner": context.repo.owner,
"repo": context.repo.repo,
"issue_number": context.payload.issue.number,
- "labels": component_labels,
+ "labels": component_labels.concat(non_component_labels),
});