[all-commits] [llvm/llvm-project] 38c706: [GitHub][workflows] Ask reviewers to merge PRs whe...

David Spickett via All-commits all-commits at lists.llvm.org
Tue Feb 13 06:52:14 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 38c706e30f5f339bfb0bfb26fd7b5c2d5086064a
      https://github.com/llvm/llvm-project/commit/38c706e30f5f339bfb0bfb26fd7b5c2d5086064a
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    A .github/workflows/approved-prs.yml
    M llvm/utils/git/github-automation.py

  Log Message:
  -----------
  [GitHub][workflows] Ask reviewers to merge PRs when author cannot (#81142)

This uses
https://pygithub.readthedocs.io/en/stable/github_objects/Repository.html?highlight=get_collaborator_permission#github.Repository.Repository.get_collaborator_permission.

Which does
https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#get-repository-permissions-for-a-user
and returns the top level "permission" key.

This is less detailed than the user/permissions key but should be fine
for this
use case.

When a review is submitted we check:
* If it's an approval.
* Whether we have already left a merge on behalf comment (by looking for
a hidden HTML comment).
* Whether the author has permissions to merge their own PR. 
* Whether the reviewer has permissions to merge.

If needed we leave a comment tagging the reviewer. If the reviewer also
doesn't have merge permission, then it asks them to find someone else
who does.




More information about the All-commits mailing list