Notify authors of Pull Request about failed builds

notifications

#1

At this point only project subscribers are notified if build fails.

It’ll be great if person that submits pull request recieves automatic notification from Circle CI if branch they propose for merge fails.

As a side note, it’s also demanded feature in Travis CI system, but it looks they have hard time providing that -> https://github.com/travis-ci/travis-ci/issues/2128

Hopefully it’ll not be the case with Circle CI :wink:


#2

Would it be an option for you to send this notification manually during the build, for example by querying the GitHub API for the PR developer’s email and then sending them a note via an email API like Mailgun / Slack API or similar?


#3

@alexey I think it’s totally great if there’s some hook that can easily be setup that would do that automatically

I didn’t thought about such solution before, but I think it’s possible to solve it that way, and should be good enough. Maybe such (or very similar hook) already exists?

Answering your question more directly: If by manual you mean: that some person prepares an email manually, then it hardly makes any improvement.


#4

Manual as in your circle.yml has a call to the Mailgun API with all the correct parameters, of which some (like the message text) are hard-coded but others like PR submitter’s email address are collected during the build right before the API call. Does that make sense?


#5

@alexey looks great, if it’s possible now, can you paste example of configuration I should input into circle.yml to obtain that?


#6

I used this example from the Mailgun API docs:

test:
  override:
    - test-command || touch failure.txt && exit 1
  post:
    - "if [ -f failure.txt ] ; then curl -s --user 'api:$MAILGUN_API_KEY' 
    https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages 
    -F from='Name <mailgun@YOUR_DOMAIN_NAME>' 
    -F to=committer@example.org 
    -F subject='You broke the tests' 
    -F text='You broke the build on the branch $CIRCLE_BRANCH in the project
     $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME on CircleCI :('"

I am not yet sure about the committer’s name—you should be able to get it with GitHub’s API, as you have the project name, plus the $CIRCLE_SHA1 contains the revision being built.


#7