mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 01:59:26 +00:00
danger: check backport commits for original commit IDs
A full backport must have all the commit from the original MR and the original commit IDs must be referenced in the backport commit messages. If the criteria above is not met, the MR should be marked as a partial backport. In that case, any discrepencies are only logged as informative messages rather than failures.
This commit is contained in:
parent
89530f1a1c
commit
c617f97784
@ -209,6 +209,28 @@ if is_backport:
|
||||
f"Original MR !{original_mr_id} has not been merged. "
|
||||
"Please re-run `danger` check once it's merged."
|
||||
)
|
||||
else: # check for commit IDs once original MR is merged
|
||||
original_mr_commits = list(original_mr.commits(all=True))
|
||||
backport_mr_commits = list(mr.commits(all=True))
|
||||
for orig_commit in original_mr_commits:
|
||||
for backport_commit in backport_mr_commits:
|
||||
if orig_commit.id in backport_commit.message:
|
||||
break
|
||||
else:
|
||||
msg = (
|
||||
f"Commit {orig_commit.id} from original MR !{original_mr_id} "
|
||||
"is not referenced in any of the backport commits."
|
||||
)
|
||||
if not is_full_backport:
|
||||
message(msg)
|
||||
else:
|
||||
msg += (
|
||||
" Please use `-x` when cherry-picking to include "
|
||||
"the full original commit ID. Alternately, use the "
|
||||
"`Backport::Partial` label if not all original "
|
||||
"commits are meant to be backported."
|
||||
)
|
||||
fail(msg)
|
||||
if not is_backport and not version_labels:
|
||||
fail(
|
||||
"If this merge request is a backport, set the *Backport* label and "
|
||||
|
Loading…
x
Reference in New Issue
Block a user