From a1f0d429fcd520497df40182adaac5efaaacb338 Mon Sep 17 00:00:00 2001 From: phlax Date: Mon, 25 Apr 2022 19:15:42 +0100 Subject: [PATCH] repokitteh: Print docs link (#20970) - in response to /docs command - for any PR that has a prefix of `docs:` Signed-off-by: Ryan Northey --- ci/repokitteh/modules/docs.star | 28 ++++++++++++++++++++++++++++ repokitteh.star | 1 + 2 files changed, 29 insertions(+) create mode 100644 ci/repokitteh/modules/docs.star diff --git a/ci/repokitteh/modules/docs.star b/ci/repokitteh/modules/docs.star new file mode 100644 index 000000000000..8bd268946d79 --- /dev/null +++ b/ci/repokitteh/modules/docs.star @@ -0,0 +1,28 @@ + +DOCS_LINK_MESSAGE = """ + +Docs for this Pull Request will be rendered here: + +https://storage.googleapis.com/envoy-pr/%s/docs/index.html + +The docs are (re-)rendered each time the CI `envoy-presubmit (precheck docs)` job completes. + +""" + +def should_add_docs_link(action, issue_title): + return ( + action == 'opened' + and issue_title.startswith("docs:")) + +def add_docs_link(issue_number): + github.issue_create_comment(DOCS_LINK_MESSAGE % issue_number) + +def _pr(action, issue_number, issue_title): + if should_add_docs_link(action, issue_title): + add_docs_link(issue_number) + +def _add_docs(issue_number): + add_docs_link(issue_number) + +handlers.pull_request(func=_pr) +handlers.command(name='docs', func=_add_docs) diff --git a/repokitteh.star b/repokitteh.star index c5aa3ddf66f1..189510c5399e 100644 --- a/repokitteh.star +++ b/repokitteh.star @@ -4,6 +4,7 @@ use("github.com/repokitteh/modules/assign.star") use("github.com/repokitteh/modules/review.star") use("github.com/repokitteh/modules/wait.star") 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/docs.star") use("github.com/envoyproxy/envoy/ci/repokitteh/modules/newpr.star") use( "github.com/envoyproxy/envoy/ci/repokitteh/modules/ownerscheck.star",