summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java4
-rw-r--r--src/main/java/uk/co/blatech/blaears/models/gitlab/Push.java9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java b/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java
index 9d461c9..eca58ec 100644
--- a/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java
+++ b/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java
@@ -23,6 +23,10 @@ public class GitPushController {
@RequestMapping(value = "/git/push", method = RequestMethod.POST)
String push(@RequestBody Push pushMsg, Model model){
+ if (!pushMsg.getRef().endsWith("master")) {
+ log.info("Push is not to master, dropping message");
+ return "gitlab";
+ }
try {
String commitMsg = "";
for (Commit commit: pushMsg.getCommits()) {
diff --git a/src/main/java/uk/co/blatech/blaears/models/gitlab/Push.java b/src/main/java/uk/co/blatech/blaears/models/gitlab/Push.java
index bc20045..8d81a01 100644
--- a/src/main/java/uk/co/blatech/blaears/models/gitlab/Push.java
+++ b/src/main/java/uk/co/blatech/blaears/models/gitlab/Push.java
@@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class Push {
String objectKind;
+ String ref;
@JsonProperty("user_name")
String userName;
Repository repository;
@@ -24,6 +25,14 @@ public class Push {
this.objectKind = objectKind;
}
+ public String getRef() {
+ return ref;
+ }
+
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+
public String getUserName() {
return userName;
}