Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watch for commits to a file

Tags:

git

bitbucket

Is there any notification at all (Email, Text, Message-On-Screen, colored text, anything) that can tell me if a specific file has been committed?

For example: If a developer commits changes to the Web.Config, or to Source/Lawls/CrazySauce.js, what options do I have to bring that to my attention?

At the very least, something Pull-Request related would be okay. Though I'm not always the one approving/merging. At best, an email or automatic Jira ticket or something would be great.

like image 784
Suamere Avatar asked Apr 22 '16 14:04

Suamere


1 Answers

Bitbucket (like GitHub and other git hosting providers) supports webhooks, a feature that will make a POST request to a URL of your choice whenever certain actions occur on your repository.

It would be fairly easy to write a simple server that would receive a webhook and perform some sort of notification.

Note that based on the content of the push notification, the list of modified files isn't available to your directly. You would need to consume the information from the webhook and then do something to get the list of files in the selected commit: for example, by maintaining a local clone of the repository, updating it, and using that to get information about which files were modified.

like image 145
larsks Avatar answered Nov 10 '22 00:11

larsks