Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

feat: Add PR requester for external reviewers#446

Merged
CPerezz merged 3 commits into
mainfrom
add_external_reviewers
Apr 13, 2022
Merged

feat: Add PR requester for external reviewers#446
CPerezz merged 3 commits into
mainfrom
add_external_reviewers

Conversation

@CPerezz
Copy link
Copy Markdown
Contributor

@CPerezz CPerezz commented Apr 8, 2022

Deprecates #438 and instead adds the external_reviewers to the PR
reviews using a 3rd party application.

That is done like this to avoid including a lot of people into
appliedzkp org and granting custom permissions each time we want to
add a new reviewer.

Resolves: #429 completely.

@CPerezz CPerezz requested review from a team and han0110 and removed request for a team April 8, 2022 16:17
@CPerezz CPerezz requested review from ChihChengLiang and removed request for han0110 April 8, 2022 16:18
@CPerezz CPerezz force-pushed the add_external_reviewers branch from 7b68e7a to 138932c Compare April 8, 2022 16:27
@github-actions github-actions Bot requested a review from icemelon April 8, 2022 16:32
@CPerezz CPerezz force-pushed the add_external_reviewers branch from 194a68e to 1bf5044 Compare April 8, 2022 16:33
@CPerezz
Copy link
Copy Markdown
Contributor Author

CPerezz commented Apr 8, 2022

In order to make this work, we need that all the added participants of the external-reviewers group declared in .github/reviewer-lottery.yml

To prove this works I made the PR now just with @icemelon as is the only of the members who is added as collaborator for this repo. So it works.

@icemelon
Copy link
Copy Markdown
Collaborator

icemelon commented Apr 8, 2022

@CPerezz Yes, I received the email notification of the review request to this PR.

@ChihChengLiang
Copy link
Copy Markdown
Collaborator

@DreamWuGit can you check your email for repo invitation?

@DreamWuGit
Copy link
Copy Markdown
Collaborator

DreamWuGit commented Apr 12, 2022

@DreamWuGit can you check your email for repo invitation?
just check zkevm-circuit repo invitation and accepted :) Do you mean review request email for this PR ?

@ChihChengLiang
Copy link
Copy Markdown
Collaborator

@DreamWuGit Thank you :) I mean just the repo invitation, not the review request.

@CPerezz CPerezz force-pushed the add_external_reviewers branch from 1bf5044 to 139ae57 Compare April 12, 2022 11:45
@github-actions github-actions Bot added the CI Issues related to the Continuous Integration mechanisms of the repository. label Apr 12, 2022
@github-actions github-actions Bot requested a review from roynalnaruto April 12, 2022 11:48
@CPerezz CPerezz removed the request for review from roynalnaruto April 12, 2022 11:51
@CPerezz
Copy link
Copy Markdown
Contributor Author

CPerezz commented Apr 12, 2022

@ChihChengLiang @icemelon could you take another look and approve? All the members are set now 🎉

CPerezz added 2 commits April 12, 2022 14:58
Deprecates #438 and instead adds the external_reviewers to the PR
reviews using a 3rd party application.

That is done like this to avoid including a lot of people into
`appliedzkp` org and granting custom permissions each time we want to
add a new reviewer.

Resolves: #429 completely.
Force-pushing to the PR currently re-triggers the workflow by assigning
to the PR a new member of the team while mantaining the previous.
That's an issue as we end up with multiple reviewers on each PR when
indeed we just need one.

See: uesteibar/reviewer-lottery#26 for more
details.
@CPerezz CPerezz force-pushed the add_external_reviewers branch from 872de15 to 8d28c15 Compare April 12, 2022 12:58
Copy link
Copy Markdown
Collaborator

@ChihChengLiang ChihChengLiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CPerezz CPerezz merged commit c12d61f into main Apr 13, 2022
@CPerezz CPerezz deleted the add_external_reviewers branch April 13, 2022 08:45
@ntampakas
Copy link
Copy Markdown
Contributor

Moving conversation from #467

Following up on the previous message, here is the implementation we have concluded on with pros and cons.

  1. Every PR (either from fork or not) creates and uploads an artifact on base repo, consisting of all PR info.
  2. A second workflow runs periodically as a scheduled task, downloads and extracts the artifact and in general may run any action requiring access to GitHub token: In our case the action is to randomly select reviewer(s) and assign them in PR.
    Pros:
    No need to distribute tokens to external accounts, as first artifact creation requires no write permission.
    Same concept can be used for providing benchmark results in comments.

Cons:
Second workflow is executed as a cron job, so it will flood the actions history with workflow run records. It will make it a bit annoying to read the actions history (without filtering).
As mentioned in the comment above, Github does no guarantee that the workflow using the schedule event, will run at the pre-defined time. Therefore reviewers assignment, might take more than expected.

If everyone agrees on this approach, i will shortly raise a PR for review.

@ntampakas
Copy link
Copy Markdown
Contributor

ntampakas commented Apr 27, 2022

@DreamWuGit,
Regarding the last GH Action that worked: Did you use a new token or did you try something different?

This probably needs further investigation.

@ChihChengLiang , did you by any chance apply different permission levels against @DreamWuGit account/repo?
Just trying to figure out what is wrong :)

@CPerezz
Copy link
Copy Markdown
Contributor Author

CPerezz commented Apr 27, 2022

Moving conversation from #467

Following up on the previous message, here is the implementation we have concluded on with pros and cons.

1. Every PR (either from fork or not) creates and uploads an artifact on base repo, consisting of all PR info.

2. A second workflow runs periodically as a scheduled task, downloads and extracts the artifact and in general may run any action requiring access to GitHub token: In our case the action is to randomly select reviewer(s) and assign them in PR.
   Pros:
   No need to distribute tokens to external accounts, as first artifact creation requires no write permission.
   Same concept can be used for providing benchmark results in comments.

Cons: Second workflow is executed as a cron job, so it will flood the actions history with workflow run records. It will make it a bit annoying to read the actions history (without filtering). As mentioned in the comment above, Github does no guarantee that the workflow using the schedule event, will run at the pre-defined time. Therefore reviewers assignment, might take more than expected.

If everyone agrees on this approach, i will shortly raise a PR for review.

The solution doesn't look too resilient. Seems that introduced overhead and also we need to wait for the assignations anyway.
My suggestion is to simply remove this workflow for now and doo the assignation of the Scroll members manually.

@ntampakas
Copy link
Copy Markdown
Contributor

ntampakas commented Apr 27, 2022

Moving conversation from #467
Following up on the previous message, here is the implementation we have concluded on with pros and cons.

1. Every PR (either from fork or not) creates and uploads an artifact on base repo, consisting of all PR info.

2. A second workflow runs periodically as a scheduled task, downloads and extracts the artifact and in general may run any action requiring access to GitHub token: In our case the action is to randomly select reviewer(s) and assign them in PR.
   Pros:
   No need to distribute tokens to external accounts, as first artifact creation requires no write permission.
   Same concept can be used for providing benchmark results in comments.

Cons: Second workflow is executed as a cron job, so it will flood the actions history with workflow run records. It will make it a bit annoying to read the actions history (without filtering). As mentioned in the comment above, Github does no guarantee that the workflow using the schedule event, will run at the pre-defined time. Therefore reviewers assignment, might take more than expected.
If everyone agrees on this approach, i will shortly raise a PR for review.

The solution doesn't look too resilient. Seems that introduced overhead and also we need to wait for the assignations anyway. My suggestion is to simply remove this workflow for now and doo the assignation of the Scroll members manually.

Indeed, it adds unnecessary complexity.
Please let us investigate it a little bit more, since DreamWuGit` s last PR worked with that GH action.

@DreamWuGit
Copy link
Copy Markdown
Collaborator

DreamWuGit commented Apr 28, 2022

@DreamWuGit, Regarding the last GH Action that worked: Did you use a new token or did you try something different?

This probably needs further investigation.

@ntampakas you mean github personal token in setting ? I don't change it as it is not expired at the moment , I am not aware of something different rather than git push operation ! feel free to let me know if you need to check specific

@0xmountaintop
Copy link
Copy Markdown
Collaborator

0xmountaintop commented Apr 28, 2022

This problem can be simply solved by changing "pull_request"(external_reviewers_assig.yml#L3) to "pull_request_target"

As explained at the end of https://github.com/marketplace/actions/auto-request-review

Note that with the recent change to GitHub Actions that are created by Dependabot, the pull_request event will no longer give access to your secrets to this action. Instead you will need to use the pull_request_target event. If you do this make sure to read Keeping your GitHub Actions and workflows secure: Preventing pwn requests to understand the risks involved.

& at the end of https://github.com/marketplace/actions/reviewer-lottery

Why on pull_request_target?

By running this action on pull_request_target we enable this action to be performed on PRs opened by users with readonly access to the repo, for example those by Dependabot.

@ntampakas
Copy link
Copy Markdown
Contributor

@HAOYUatHZ , this really seems to resolve the issue (verifying after testing against local GH accounts).
What concerns me is, why sometimes the action works and sometimes not.

@CPerezz , may i ask what was the reason this workflow was implemented using the pull_request event and not pull_request_target?

@ntampakas
Copy link
Copy Markdown
Contributor

ntampakas commented Apr 28, 2022

Also, as far as i can see from succeeded Reviewer lottery GH actions, external-zkevm-reviewers from reviewer-lottery.yml file seem not to be assigned in any PR coming from fork.

@CPerezz
Copy link
Copy Markdown
Contributor Author

CPerezz commented Apr 29, 2022

@HAOYUatHZ , this really seems to resolve the issue (verifying after testing against local GH accounts). What concerns me is, why sometimes the action works and sometimes not.

@CPerezz , may i ask what was the reason this workflow was implemented using the pull_request event and not pull_request_target?

No particular reason. We can change it but I don't think is going to make any difference.

Also, as far as i can see from succeeded Reviewer lottery GH actions, external-zkevm-reviewers from reviewer-lottery.yml file seem not to be assigned in any PR coming from fork.

This is because they're requested a review from the CODEOWNERS file directly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CI Issues related to the Continuous Integration mechanisms of the repository.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants