def get_newest_commit(self, user): """ Calls github and retrieves the current git hash of the most recent code push to the default branch of the repo """ branch = get_default_branch(self, user) git_hash = get_branch_details(self, user, branch) return (branch, git_hash)
def save(self, user=None, *args, **kwargs): if not self.deploy_key: self.deploy_key, self.deploy_key_secret = generate_ssh_keys() if not self.environments.exists() and user: branch = get_default_branch(self, user) self.environments.create( name=self.DEFAULT_ENV, deploy_type=Environment.PROMOTE) self.environments.create(name='Staging', branch=branch) super(Site, self).save(*args, **kwargs)