Skip to content

Commit

Permalink
repokitteh: Add welcome message for new contributors
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <ryan@synca.io>
  • Loading branch information
phlax committed Sep 30, 2020
1 parent b63855d commit 5ad3a30
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
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 @@

# not sure if this is needed, or whether `pull_request` below has info 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(pull_request):
# check for any existing open PRs from user ?
return pull_request["author_association"] == "FIRST_TIME_CONTRIBUTOR"

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

def send_newcontributor_message(sender):
github.issue_create_comment("""
hi @%s, welcome and thankyou 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.
""" % sender)

def _pr(action, pull_request, sender, config):
if should_message_newcontributor(action, pull_request):
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

0 comments on commit 5ad3a30

Please sign in to comment.