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

repokitteh: Add welcome message for new contributors #13309

Merged
merged 4 commits into from
Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions ci/repokitteh/modules/newcontributor.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

NEW_CONTRIBUTOR_MESSAGE = """
Hi @%s, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the [contribution guidelines](https://github.com/envoyproxy/envoy/blob/master/CONTRIBUTING.md) if you have not done so already.

"""

def get_pr_author_association(issue_number):
return github.call(
method="GET",
path="repos/envoyproxy/envoy/pulls/%s" % issue_number)["json"]["author_association"]

def is_newcontributor(issue_number):
return get_pr_author_association(issue_number) == "FIRST_TIME_CONTRIBUTOR"
phlax marked this conversation as resolved.
Show resolved Hide resolved

def should_message_newcontributor(action, issue_number):
return (
action == 'opened'
and is_newcontributor(issue_number))

def send_newcontributor_message(sender):
github.issue_create_comment(NEW_CONTRIBUTOR_MESSAGE % sender)

def _pr(action, issue_number, sender, config):
if should_message_newcontributor(action, issue_number):
send_newcontributor_message(sender)

handlers.pull_request(func=_pr)
1 change: 1 addition & 0 deletions repokitteh.star
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use("github.com/repokitteh/modules/review.star")
use("github.com/repokitteh/modules/wait.star")
use("github.com/repokitteh/modules/circleci.star", secret_token=get_secret('circle_token'))
use("github.com/envoyproxy/envoy/ci/repokitteh/modules/azure_pipelines.star", secret_token=get_secret('azp_token'))
use("github.com/envoyproxy/envoy/ci/repokitteh/modules/newcontributor.star")
use(
"github.com/envoyproxy/envoy/ci/repokitteh/modules/ownerscheck.star",
paths=[
Expand Down