Labeller action can remove labels from PR upon sync (#96131)

## About The Pull Request
#92553 made it possible for the PR author to add labels to the PR body
whenever it was updated however as discussed in the comments it was not
possible to remove labels.

Maintainers can still add/remove labels and that works as expected but
the PR author could not. This obviously is inconvenient and should not
be the case but now it is possible.

This will not conflict with maintainer added/removed labels which means
if the author says like removes the balance label from their changelog,
but the maintainer adds the balance label then the balance label will
always stay and cannot be removed by the author so labelling still works
as intended.

It will only remove labels added by the contributor should they decide
to change their changelog/modified files/PR title at any point

## Changelog
N/A

---------

Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
SyncIt21
2026-06-07 22:39:18 -07:00
committed by GitHub
co-authored by Bloop
parent fac7cbae25
commit 6f4914aa76
+4 -2
View File
@@ -177,12 +177,11 @@ export async function get_updated_label_set({ github, context }) {
const {
body = "",
diff_url,
labels = [],
mergeable,
title = "",
} = pull_request;
const updated_labels = new Set(labels.map((l) => l.name));
const updated_labels = new Set();
// Always check file diffs
if (diff_url) {
@@ -224,6 +223,9 @@ export async function get_updated_label_set({ github, context }) {
}
} catch (error) {
console.error("Error fetching paginated events:", error);
for(const label of pull_request.labels){
updated_labels.add(label.name);
}
}
// Always remove Test Merge Candidate