<p>Considering you have proper credentials in Jenkins and admin right for Git repo, Create a webhook between Jenkins and your Git repo. Webhook will help you push (reverse poll)the commits. You can use jenkins DSL (groovy) to operate on that Git repo by using Git commands. You can use specific Git commands to list Authors of last commits (or any other requirement) and Use email-ext (or any other) plugin in jenkins to be able to send email through DSL.</p>

<p>One line reference to list Author (yeah..it works as it is in any Git repo)-</p>

<p>git log -1 --pretty=format:'%an'</p>

<p>My reference of email to culprits if something goes wrong my jenkins build</p>

<p>step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])])</p>

CC BY-SA 4.0
2019-05-30T12:08:45.013Z
2019-05-30T12:08:45.013Z
GGG
<p>I need to know how to write a Jenkins job which polls a GitHub repository continuously and send an email of commits made to that repo.</p>

<jenkins><github>
How to keep polling GitHub repository and get commits by it's messages on a regular interval using Jenkins?
Esaki Raja
# How to keep polling GitHub repository and get commits by it's messages on a regular interval using Jenkins?

(Asked by: username_0 on 2019-05-29)

I need to know how to write a Jenkins job which polls a GitHub repository continuously and send an email of commits made to that repo.

**Tags:** jenkins, github


---

## 1 answers

### Answer by username_1 on 2019-05-30. Score: 1

Considering you have proper credentials in Jenkins and admin right for Git repo, Create a webhook between Jenkins and your Git repo. Webhook will help you push (reverse poll)the commits. You can use jenkins DSL (groovy) to operate on that Git repo by using Git commands. You can use specific Git commands to list Authors of last commits (or any other requirement) and Use email-ext (or any other) plugin in jenkins to be able to send email through DSL.

One line reference to list Author (yeah..it works as it is in any Git repo)-

git log -1 --pretty=format:'%an'

My reference of email to culprits if something goes wrong my jenkins build

step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])])


---

