Add TAG_PUSH action type and detect tag_push using the objectKind in the original cause.
This commit is contained in:
parent
a30898a921
commit
ff495a0d0d
|
@ -376,12 +376,12 @@ public final class CauseData {
|
|||
PUSH {
|
||||
@Override
|
||||
String getShortDescription(CauseData data) {
|
||||
String pushedBy = data.getTriggeredByUser();
|
||||
if (pushedBy == null) {
|
||||
return Messages.GitLabWebHookCause_ShortDescription_PushHook_noUser();
|
||||
} else {
|
||||
return Messages.GitLabWebHookCause_ShortDescription_PushHook(pushedBy);
|
||||
return getShortDescriptionPush(data);
|
||||
}
|
||||
}, TAG_PUSH {
|
||||
@Override
|
||||
String getShortDescription(CauseData data) {
|
||||
return getShortDescriptionPush(data);
|
||||
}
|
||||
}, MERGE {
|
||||
@Override
|
||||
|
@ -418,6 +418,15 @@ public final class CauseData {
|
|||
}
|
||||
};
|
||||
|
||||
private static String getShortDescriptionPush(CauseData data) {
|
||||
String pushedBy = data.getTriggeredByUser();
|
||||
if (pushedBy == null) {
|
||||
return Messages.GitLabWebHookCause_ShortDescription_PushHook_noUser();
|
||||
} else {
|
||||
return Messages.GitLabWebHookCause_ShortDescription_PushHook(pushedBy);
|
||||
}
|
||||
}
|
||||
|
||||
abstract String getShortDescription(CauseData data);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,9 @@ class PushHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<PushHook>
|
|||
|
||||
@Override
|
||||
protected CauseData retrieveCauseData(PushHook hook) {
|
||||
CauseData.ActionType actionType = hook.getObjectKind().equals("tag_push") ? CauseData.ActionType.TAG_PUSH : CauseData.ActionType.PUSH;
|
||||
return causeData()
|
||||
.withActionType(CauseData.ActionType.PUSH)
|
||||
.withActionType(actionType)
|
||||
.withSourceProjectId(hook.getProjectId())
|
||||
.withTargetProjectId(hook.getProjectId())
|
||||
.withBranch(getTargetBranch(hook))
|
||||
|
|
Loading…
Reference in New Issue