Skip to content

Commit

Permalink
Configure more locations to use the submission regex matchers
Browse files Browse the repository at this point in the history
Signed-off-by: Jose R. Gonzalez <komish@flutes.dev>
  • Loading branch information
komish committed Oct 17, 2023
1 parent f6b8d55 commit 4073946
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion scripts/src/chartprreview/chartprreview.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from report import verifier_report
from signedchart import signedchart
from pullrequest import prartifact
from reporegex import matchers
from tools import gitutils


Expand Down Expand Up @@ -58,7 +59,7 @@ def get_modified_charts(directory, api_url):
"""
print("[INFO] Get modified charts. %s" % directory)
files = prartifact.get_modified_files(api_url)
pattern = re.compile(r"charts/(\w+)/([\w-]+)/([\w-]+)/([\w\.\-+]+)/.*")
pattern = re.compile(matchers.submission_path_matcher() + r"/.*")
for file_path in files:
m = pattern.match(file_path)
if m:
Expand Down
14 changes: 13 additions & 1 deletion scripts/src/chartrepomanager/chartrepomanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@
from chartrepomanager import indexannotations
from signedchart import signedchart
from pullrequest import prartifact
from reporegex import matchers
from tools import gitutils


def get_modified_charts(api_url):
"""Reads a PR's modified files to get submission details and exits if none are found.
Args:
api_url: URL to the API representation of a pull request.
E.g. https://api.github.com/repos/openshift-helm-charts/charts/pulls/1
Returns:
The category, organization, chart name, and version.
"""
files = prartifact.get_modified_files(api_url)
pattern = re.compile(r"charts/(\w+)/([\w-]+)/([\w-]+)/([\w\.-]+)/.*")
pattern = re.compile(
matchers.submission_path_matcher(strict_categories=False) + r"/.*"
)
for file_path in files:
m = pattern.match(file_path)
if m:
Expand Down
5 changes: 4 additions & 1 deletion scripts/src/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
from indexfile import index
from pullrequest import prepare_pr_comment as pr_comment
from collections import OrderedDict
from reporegex import matchers

file_pattern = re.compile(r"charts/([\w-]+)/([\w-]+)/([\w\.-]+)/([\w\.-]+)/.*")
file_pattern = re.compile(
matchers.submission_path_matcher(strict_categories=False) + r"/.*"
)
chart_downloads_event = "Chart Downloads v1.0"
ignore_users = [
"zonggen",
Expand Down

0 comments on commit 4073946

Please sign in to comment.