I am at my wit's end here. I have been trying to write a very simple automation that can update an issues label when its due date has been changed. The format is MMMM-yyyy for the label based on due date. All I want to do is if an issue has its due date updated that 1 of 2 things will happen.
Let's say due date is 9/1/2024.
1. If no due date exists then that's really easy to add a new label for that.
2 (where I'm stuck). Let's say that I already have a label of September-2024 but now my due date update to 10/7/2024. I want a new label of October-2024 to be created and old label of September-2024 to be removed.
I was doing a basic When: Value changes for Due date Then edit issue fields Labels.
Adding a new label works fine with:
{{issue.duedate.format("MMMM-yyyy")}}
but where I'm struggling is removing the old. I've tried the below but I can't seem to figure out what I'm missing.
{{issue.labels.match("^(January|February|March|April|May|June|July|August|September|October|November|December)-\\d{4}$")}}
{{issue.duedate.change.previous.format("MMMM-yyyy")}}
Any help to point me in the right direction would be great!