Skip to content

Instantly share code, notes, and snippets.

@coorasse coorasse/main.js
Last active Feb 6, 2018

Embed
What would you like to do?
Bitbucket Codeship PullRequest integration script
$(function() {
var bitbucket_project_name = 'YOUR BITBUCKET PROJECT_NAME LIKE coorasse/airesis';
var codeship_project_code = 'YOUR CODESHIPO PROJECT UUID CODE (look for it in the badge instructions page or general settings page)';
var regexp = new RegExp("^https://bitbucket.org/" + bitbucket_project_name + "/pull-request/","g");
if ((regexp).test(window.location.href)) {
var branch = $('dd.unabridged a').first().html();
var url = 'https://codeship.com/projects/'+codeship_project_code+'/status?branch='+branch;
var row = $('<div></div>')
var column1 = $('<dt>Codeship</dt>');
var column2 = $('<dd><img src="'+url+'"/></dd>');
row.append(column1);
row.append(column2);
$('.clearfix.description').after(row);
}
});
@coorasse

This comment has been minimized.

Copy link
Owner Author

commented Jun 22, 2015

I wrote this script since the only way to integrate Codeship and Bitbucket, until today, was to follow this guide.
I didn't want to install an Heroku app just to see a badge on my Pull Request page on Bitbucket and since I already had plugin for my browser ready to inject javascript in pages I wrote this simple script.

  • fill in the bitbucket project name (with your username included)
  • fill in the codeship project UUID code (the one you see in the badge url or the codeship project general settings page)
  • inject the script in bitbucket page with your favourite plugin
  • see your badge!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.