diff --git a/src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java b/src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java index 14a5914..31c74bd 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java +++ b/src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java @@ -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); } diff --git a/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/push/PushHookTriggerHandlerImpl.java b/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/push/PushHookTriggerHandlerImpl.java index f193d3a..1631845 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/push/PushHookTriggerHandlerImpl.java +++ b/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/push/PushHookTriggerHandlerImpl.java @@ -42,8 +42,9 @@ class PushHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler @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))