diff options
author | Joe Robinson <joe@lc8n.com> | 2015-12-11 01:20:01 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2015-12-11 01:20:01 +0000 |
commit | b786cb0662072e1592498fe00084cdbe09823d16 (patch) | |
tree | b9c636d279cc139cb7aef387d23199db6bfecd60 /src | |
parent | d977d113e671ceb46c04023911fad12440a4fabd (diff) |
Only show pushes to master
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java | 4 | ||||
-rw-r--r-- | src/main/java/uk/co/blatech/blaears/models/gitlab/Push.java | 9 |
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; } |