-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add Hacktoberfest feature #134
Conversation
This change adds the new feature hacktoberfest The goal of this feature is to find flyby pull requests that are considered spam. A pull request that is a first time contributor, not signed, and only changing markdown (md) files is assumed to be spam. If the contributor has read the contribution guide, they would have signed their commit, and the handler would have no affect. Otherwise, the pull request is closed, and an invalid label is added indicating that this PR should not be counted Signed-off-by: Burton Rheutan <rheutan7@gmail.com>
I've built the container with this change available here: |
Just found out that the |
This new function will get a list of the files included in the pull request. This can be used to validate or verify what files are being changed in a particular PR. This commit adds that functionality to the hacktoberfest feature to check for typo only pull requests only changing markdown (md) files Signed-off-by: Burton Rheutan <rheutan7@gmail.com>
@alexellis I've updated the changes to include the new Tested with a lot of support from @rgee0 💯 To confirm this will not affect legitimate, signed, PRs: |
The screenshots look good. I would like to see a message from Derek explaining as briefly as possible what happened / why. This is to mitigate honest mistakes |
Signed-off-by: Burton Rheutan <rheutan7@gmail.com>
I've added a message to the handler with a link to the contributing guide as well as the Hacktoberfest "Quality Standards" here: https://hacktoberfest.digitalocean.com/details#quality-standards
|
listOpts := &github.ListOptions{ | ||
Page: 0, | ||
} | ||
commitFiles, resp, err := client.PullRequests.ListFiles(ctx, req.Repository.Owner.Login, req.Repository.Name, req.PullRequest.Number, listOpts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that isn't part of the JSON already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we found that out the hard way. The check wasn't running. After looking at the request from GH, we saw that the files
were a separate call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if we could avoid the extra API call to check files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do any files get downloaded, or is it just a list?
fetchPullRequestFiles
makes me feel like the disk is written too. If it's not written to, can we just go with listPullRequestFiles
or whatever you prefer?
} | ||
|
||
fmt.Println("Rate limiting", resp.Rate) | ||
resp.Body.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
if resp.Body!=nil {
defer resp.Body.Close()
}
This is looking good. Can we show there is no regression? Does it still work with the regular pull request use-case for DCO and for labels? Just the user guide needs updating now, in an additional commit please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge so we can start trying it out. Please take a look at the naming question and send another PR to amend, also update the user guide. |
Thank you! |
Description
This change adds the new feature
hacktoberfest
The goal of this feature is to find flyby pull requests
that are considered spam.
A pull request that is a first time contributor, not signed,
and only changing markdown (md) files is assumed to be spam.
If the contributor has read the contribution guide, they
would have signed their commit, and the handler would have
no affect.
Otherwise, the pull request is closed, and an invalid
label is added indicating that this PR should not be counted
Signed-off-by: Burton Rheutan rheutan7@gmail.com
Motivation and Context
Discussed with Alex via Slack
How Has This Been Tested?
Added unit tests to verify the "markdown only" function works as expected.
Unfortunately, I was unable to deploy and test as my deployment of Derek was not able to access the secret for some reason. I've run out of time this evening to debug further.
Types of changes
Checklist:
git commit -s
We can update the documentation once this feature passes an Alpha/Beta phase of testing