dshipper
dshipper

Reputation: 3529

Listening for Git Repo Changes

I want to write an app that given a user's GitHub account information and a repo will be notified whenever the repo is pushed to. I know I could basically save the state of the repo and poll it for changes periodically but I was wondering if there is a way to do this with a push architecture and if so how to go about it. Thanks for any help!

EDIT - I know I can probably doing this like Heroku does it by having them push to a remote server, but the ideal functionality is to know when they push to Github itself.

Upvotes: 9

Views: 9144

Answers (4)

VonC
VonC

Reputation: 1329492

One way which:

  • wouldn't involve the main contributor of a repo to enter anything
  • would allow you to define what you want to monitor

is to use:

Upvotes: 1

jweyrich
jweyrich

Reputation: 32260

If you want to perform an action when a push is received, you can write a script and use it as a post-receive hook. GitHub supports git-hooks, but for obvious reasons they do not allow you to write a "custom script". What their script do is actually simple - they notify you by POSTing a JSON to an URL you specify. See their documentation.

Upvotes: 11

wolfc
wolfc

Reputation: 2177

Why not use GitHub Service Hooks?

Post-Receive Hooks

Upvotes: 0

rubysolo
rubysolo

Reputation: 543

You should check out post-receive hooks

Upvotes: 0

Related Questions