Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be more lax on what merged PRs we detect, but post an alert. #189

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2108,9 +2108,24 @@ let project_action ~bot_info ~(issue : issue) ~column_id =
let push_action ~bot_info ~base_ref ~commits_msg =
Stdio.printf "Merge and backport commit messages:\n" ;
let commit_action commit_msg =
if string_match ~regexp:"^Merge PR #\\([0-9]*\\):" commit_msg then
let pr_number = Str.matched_group 1 commit_msg |> Int.of_string in
Lwt_io.printf "%s\nPR #%d was merged.\n" commit_msg pr_number
if
string_match ~regexp:"^Merge \\(PR\\|pull request\\) #\\([0-9]*\\)[: ]"
commit_msg
then
let merge_button_alert =
(* Might require more verification that we are not merging a
subtree from another repository. Then, we could post a
message alerting the merger than they did not use the right
method. *)
String.equal (Str.matched_group 1 commit_msg) "pull request"
in
let log_alert =
if merge_button_alert then
"Warning: the wrong merge method was used for this PR!\n"
else ""
in
let pr_number = Str.matched_group 2 commit_msg |> Int.of_string in
Lwt_io.printf "%s\nPR #%d was merged.\n%s" commit_msg pr_number log_alert
>>= fun () ->
GitHub_queries.get_pull_request_id_and_milestone ~bot_info ~owner:"coq"
~repo:"coq" ~number:pr_number
Expand Down