Repository Push/Commit Notifications

Last updated by Adam West on April 11, 2018 15:11

Codebase supports sending HTTP notifications to a URL when a repository is pushed (Git/Mercurial/Bazaar) or committed (Subversion) to. This allows Codebase to be integrated with 3rd party applications or your own scripts and can be useful for activities like automatically triggering a deployment to your production servers when a new commit is made.

In addition to HTTP notifications it is possible to specify an email address in the endpoint field to receive email notifications when a repository is pushed or committed to.

Setting up Notifications

Navigate to the repository you wish to create a notification on and select Settings on the right hand side of the page:

Once here, change the tab to Post-Receive Hooks. You can now enter your HTTP url or email address in the text box provided. If HTTP Authentication is required then click Add HTTP authentication details from below the text box.

Click Add and the next time your repository receives a push or commit your endpoint should receive a notification.

Data Format

HTTP post-receive notifications deliver JSON containing information about the commits in the push and the repository in general, some example data is listed below with annotations:

	"before":"fc10b3aa5a9e39ac326489805bba5c577f04db85", // Commit ref before the push    	   	  
	"after":"840daf31f4f87cb5cafd295ef75de989095f415b", // Commit ref after the push    	 
	"ref":"refs/heads/master", // Branch of the push    
		"name":"Git Repo #1", // Friendly repository name       		 
		"url":"">"> href=""> href="">"> href="">">"> ,"="">"> // URL to repository browser in Codebase       
		"clone_url":"",  // Default clone URL       
			 "ssh":"", // SSH clone URL          
			 "git":"git://", // git:// clone URL
		          "http":"">"> "=""> // HTTP clone URL       
			 "name":"Test Repositories", // Containing project friendly name          
			 "url":" ,"=""> // Containing project URL
		         "status":"active" // Containing project status       
		"name":"Dan Wentworth", // Name of user who performed the push       
		"username":"dan", // Username of user who performed push       
		"email":"" // Email address of person who performed push    
	"commits":[ // Array of commits in a push       
			"id":"840daf31f4f87cb5cafd295ef75de989095f415b", // Ref of commit          
			"message":"Extra output for the rrrraaaagh", // Commit message          
				"name":"Dan Wentworth", // Commit author             
				"email":"" // Commit email address          
			"timestamp":"Mon, 18 Jul 2011 10:50:01 +0100", // Date/Time of commit          
			"url":" "=""> }]