def create_new_branch_job_triggers(branch_id): branch = Branch.objects.get(id = branch_id) for branchjob in branch.repository.repositorynewbranchjob_set.all(): if branchjob.prefix and branch.github_name.startswith(branchjob.prefix): trigger = BranchJobTrigger( branch = branch, job = branchjob.job, ) trigger.save()
def create_new_branch_job_triggers(branch_id): branch = Branch.objects.get(id=branch_id) for branchjob in branch.repository.repositorynewbranchjob_set.all(): if branchjob.prefix and branch.github_name.startswith( branchjob.prefix): trigger = BranchJobTrigger( branch=branch, job=branchjob.job, ) trigger.save()
def create_new_branch_job_triggers(sender, **kwargs): if not kwargs['created']: # Only run on create return branch = kwargs['instance'] for branchjob in branch.repository.repositorynewbranchjob_set.all(): if branchjob.prefix and branch.github_name.startswith(branchjob.prefix): trigger = BranchJobTrigger( branch = branch, job = branchjob.job, ) trigger.save()