You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[GitHub] Add workflows to manage merging of PRs from authors without commit access
These changes aim to make contributors and reviewers aware when a PR
should be merged on the contributor's behalf.
It happens in two parts:
* Newly opened PRs will be labelled with "no-commit-access" if the
author does not have commit access.
* A new workflow will periodically check all open PRs with this
label to see if they have approvals, and all checks have finished
(not passed, just finished, some failures can be explained).
* If they do, it will remove the label and add a comment:
* Instructing the author to make it merge ready, if needed.
* Instructing approvers to merge it themselves, or to find
someone who can.
**Note:** This process could be simplified if we were able to write to the
repository in response to the event generated when an approval is given.
Due to security restrictions in GitHub, we cannot do this, see:
https://github.com/orgs/community/discussions/26651https://github.com/orgs/community/discussions/55940
Instead, we run the new workflow periodically.
Checking Check status is done using PyGitHub's version of:
https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#list-check-runs-for-a-git-reference
There are some potential corner cases here, but the idea is that
this is enough to make both author and reviewers aware that
merge on behalf is an option. From there, I hope that they can
communicate directly on the PR.
If this does not happen in practice, we can revisit this and
add more automation where it makes sense.
to_approvers=f"please find someone who can merge this PR on behalf of {self.at_users([pull.user])}"
464
+
eliflen(can_merge) ==1:
465
+
to_approvers= (
466
+
f"please merge this PR on behalf of {self.at_users([pull.user])}"
467
+
)
468
+
else:
469
+
to_approvers=f"one of you should merge this PR on behalf of {self.at_users([pull.user])}"
470
+
471
+
mergers=can_mergeifcan_mergeelseapprovers
472
+
473
+
pull.as_issue().create_comment(
474
+
f"""\
475
+
{self.at_users([pull.user])} please ensure that this PR is ready to be merged. Make sure that:
476
+
* The PR title and description describe the final changes. These will be used as the title and message of the final squashed commit. The titles and messages of commits in the PR will **not** be used.
477
+
* You have set a valid [email address](https://llvm.org/docs/DeveloperPolicy.html#github-email-address) in your GitHub account. This will be associated with this contribution.
478
+
479
+
{self.at_users(mergers)}, check that:
480
+
* The above items have been completed.
481
+
* All checks have passed, or their failure has been adequately explained.
0 commit comments