32 lines
1.2 KiB
Groovy
32 lines
1.2 KiB
Groovy
// ---------------------------------------------------------------------------------
|
|
// Postfunction: Setzt LabelManager-Feld Partneranfrage auf Partneranfrage-Abgelehnt
|
|
// ---------------------------------------------------------------------------------
|
|
|
|
// ID deines Label-Manager-Feldes
|
|
final LABEL_MANAGER_CF_ID = 'customfield_11037'
|
|
|
|
// Welchen Eintrag setzen?
|
|
final SELECTED_LABEL = 'Partneranfrage-Abgelehnt'
|
|
final LABEL_COLOR = 'red' // oder "red", "green", etc.
|
|
final LABEL_SOURCE = 'project' // weil eine projekt-spezifische Konfig verwendet wird
|
|
|
|
// Issue-Key aus dem Workflow-Kontext
|
|
def issueKey = issue.key
|
|
|
|
def response = put("/rest/api/3/issue/${issueKey}")
|
|
.header('Content-Type', 'application/json')
|
|
.body([
|
|
fields: [
|
|
// wichtig: Feld-ID als Schlüssel, Value ist ein Objekt mit labels/colors/labelSource
|
|
(LABEL_MANAGER_CF_ID): [
|
|
labels : [SELECTED_LABEL],
|
|
colors : [LABEL_COLOR],
|
|
labelSource: LABEL_SOURCE
|
|
]
|
|
]
|
|
])
|
|
.asString()
|
|
|
|
if (response.status != 204) {
|
|
logger.warn "Label-Manager-Feld konnte nicht aktualisiert werden: ${response.status} - ${response.body}"
|
|
} |