From c8a1b2b1ae1a6eb6ec7a15b977439a118b38dbf1 Mon Sep 17 00:00:00 2001 From: phlax Date: Mon, 16 Dec 2024 17:30:23 +0000 Subject: [PATCH] ci/github: Add `workflows:untested` label to PRs that change workflows (#37685) Signed-off-by: Ryan Northey --- ci/repokitteh/modules/workflows.star | 22 ++++++++++++++++++++++ repokitteh.star | 1 + 2 files changed, 23 insertions(+) create mode 100644 ci/repokitteh/modules/workflows.star diff --git a/ci/repokitteh/modules/workflows.star b/ci/repokitteh/modules/workflows.star new file mode 100644 index 000000000000..9f0704ffe119 --- /dev/null +++ b/ci/repokitteh/modules/workflows.star @@ -0,0 +1,22 @@ +# Flags when a Pull request makes changes to .github/ +# +# use("github.com/repokitteh/modules/workflows.star") +# + +load("text", "match") + +UNTESTED_WORKFLOWS_LABEL = "workflows:untested" + + +def _check_workflow_changes(): + matched = [f for f in github.pr_list_files() if match("^\.github/.*", f['filename'])] + if matched: + github.issue_label(UNTESTED_WORKFLOWS_LABEL) + + +def _pr(action): + if action in ['synchronize', 'opened']: + _check_workflow_changes() + + +handlers.pull_request(func=_pr) diff --git a/repokitteh.star b/repokitteh.star index 1e67dbe810c6..f16679878f2c 100644 --- a/repokitteh.star +++ b/repokitteh.star @@ -51,6 +51,7 @@ use( ], ) use("github.com/envoyproxy/envoy/ci/repokitteh/modules/versionchange.star") +use("github.com/envoyproxy/envoy/ci/repokitteh/modules/workflows.star") def _backport(): github.issue_label('backport/review')