-
Notifications
You must be signed in to change notification settings - Fork 0
/
github.yaml
55 lines (53 loc) · 1.52 KB
/
github.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
49
50
51
52
53
54
55
---
systems:
github:
functions:
get_PR_files:
target:
system: github
function: api
parameters:
URL: 'https://api.github.com/repos/{{ coalesce .wfdata.repo .event.json.repository.full_name }}/pulls/{{ coalesce .wfdata.number .event.json.number }}/files'
method: GET
workflows:
git_PR_contains:
type: data
content:
work_status: >-
{{- $found := false }}
{{- $wfdata := .wfdata }}
{{- range (coalesce .wfdata.files .data.json .wfdata.work_data.json) }}
{{- if (not $found) }}
{{- $file := (index . "filename") }}
{{- range $wfdata.patterns }}
{{- if (not $found) }}
{{- if (regexMatch . $file) }}success
{{- $found = true }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if (not $found) }}failure
{{- end }}
reason: No file matching any of the patterns in PR
git_fetch_PR_contains:
content: pipe
data:
on_error: exit
"*steps":
- name: fetch PR files
work:
type: function
content:
target:
system: '{{ default "github" .wfdata.git_system }}'
function: get_PR_files
- name: preserve PR files
work:
type: data
content:
work_data: '{{ `{{ .data | toJson | printf ":yaml:%s" }}` }}'
- name: check PR files
work:
content: git_PR_contains