-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (43 loc) · 1.42 KB
/
pr_checks.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: PR Checks
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
jobs:
correctness_check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: install helm
run: |
curl -O https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
bash get-helm-3
- name: lint changed charts
shell: "/usr/bin/python3 {0}"
run: |
from subprocess import run
from sys import exit
from os.path import isdir
from re import compile
regex = compile("^(.*?/.*?)/.*$")
changelist = run(["git", "diff", "--name-only", "HEAD~1"],capture_output=True)
changelist = [r for r in changelist.stdout.decode("utf-8").strip().split('\n') if r.startswith('stable/')]
changeset = set()
for item in changelist:
match = regex.match(item)
if len(match.groups()) > 0:
changeset.add(match.group(1))
changelist = list(changeset) # convert set to list
changelist = [c for c in changelist if isdir(c)] # make sure the chart dir exists
if len(changelist) > 0:
lint_cmd = ["helm","lint"]
lint_cmd.extend(changelist)
print(lint_cmd)
res = run(lint_cmd)
exit(res.returncode)