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

[AlgoCollector] Pull request requirement #1460

Open
ledongthuc opened this issue Aug 8, 2021 · 9 comments
Open

[AlgoCollector] Pull request requirement #1460

ledongthuc opened this issue Aug 8, 2021 · 9 comments

Comments

@ledongthuc
Copy link
Collaborator

ledongthuc commented Aug 8, 2021

Source code: https://github.com/ruby-vietnam/hardcore-rule/tree/master/algorithms/collector

Background

  • Algorithm collector will go through all "open" pull requests and do score calculations.

Problems

  • Sometimes, "open" pull requests is not algorithm purpose. The algorithm collector counts it as a pull request of the weekly algorithm.

Proposal

  • Only check pull requests that have changed files in a folder algorithm
@ghost
Copy link

ghost commented Aug 8, 2021

I think I can take this issue

@ghost
Copy link

ghost commented Aug 8, 2021

@ledongthuc I don't think Github API provided a list of changed files when we get PR list. To have this we need another API call per PR. I don't like this approach. Instead, we have PR's body information that might contain information we needed:

Title: "2021 - SS2 - Week4 - khoa",
Body:"- SlackAcc: khoa
- [x] Problem 1
- [x] Problem 2
- [ ] Problem 3
- [ ] Problem 4
"

For example, with a PR like above, we can make sure a PR is for algorithm submit by checking for - [x] Problem or - [ ] Problem. And I think this is enough.

What do you think?

@rovn208
Copy link
Contributor

rovn208 commented Aug 9, 2021

I think we should create a convention for the Algorithm Weekly Pull request title such as [Algorithm] or [Algorithm Weekly]
i.e "[Algorithm Weekly] 2021 - SS2 - Week4 - khoa" or something like that. By using it, the PR checking will be more consistent and reliable.

@ghost
Copy link

ghost commented Aug 9, 2021 via email

@ledongthuc
Copy link
Collaborator Author

@ZephyrOneD @ngocro208, In case Github API doesn't support changed files in API listing PRs, maybe detect patterns is a good solution. I think PR's title prefix is better than body content parsing, the [Algorithm].

But it requires everyone must follow the title convention.

Another option if we want to detect files is using a Github action that use to add labels to Pull Request bases on their file changes. Then AlgoCollector will read the PR label to detect.

https://github.com/actions/labeler

If you need to support to add the github action to test, I can do it.

@ghost
Copy link

ghost commented Aug 9, 2021 via email

@ledongthuc
Copy link
Collaborator Author

Ok, finally, I suggest using both title prefix [Algorithm Week] or [Algorithm] or has the label "algo" (e.g. https://github.com/ruby-vietnam/hardcore-rule/pulls?q=is%3Apr+is%3Aclosed+label%3Aalgo)

@ledongthuc
Copy link
Collaborator Author

hi @huytd, I added a Github action that automatically adds the label algo with PR that changes on folder algorithms/
Feel free to use the label algo to detect file changes

@rovn208
Copy link
Contributor

rovn208 commented Aug 14, 2021

Hi @ledongthuc, the labeler does not work for forks repo . I think we could apply the PR title prefix for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants