Skip to content

Commit 78497c4

Browse files
committed
buildbot: Add the ability to require that a PR branch has a certain commit before building
1 parent ff1ab65 commit 78497c4

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

central/buildbot.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,29 @@ def run(self):
128128
events.dispatcher.dispatch("prbuilder", status_evt)
129129
continue
130130

131+
if cfg.github.required_commits and repo in cfg.github.required_commits:
132+
required_commit = getattr(cfg.github.required_commits, repo)
133+
134+
compare_url = pr["head"]["repo"]["compare_url"]
135+
compare_result = requests.get(
136+
compare_url.format(base=required_commit, head=pr["head"]["ref"])
137+
).json()
138+
139+
if not compare_result["status"] in ["ahead", "identical"]:
140+
status_evt = events.BuildStatus(
141+
repo,
142+
head_sha,
143+
shortrev,
144+
"default",
145+
pr_id,
146+
False,
147+
False,
148+
"",
149+
"PR branch is too out-of-date, please rebase.",
150+
)
151+
events.dispatcher.dispatch("prbuilder", status_evt)
152+
continue
153+
131154
# mergeable can be None!
132155
if pr["mergeable"] is False:
133156
status_evt = events.BuildStatus(

config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ github:
4040
refresh_interval: 600
4141
hook_hmac_secret: SECRET
4242
rebuild_command: "@dolphin-emu-bot rebuild"
43+
required_commits:
44+
dolphin-emu/dolphin: deadbeef
4345

4446
buildbot:
4547
url: https://dolphin.ci/

0 commit comments

Comments
 (0)