File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 18
18
- uses : actions/checkout@v2
19
19
20
20
- name : Check content
21
-
21
+
22
22
with :
23
23
expression : ^contributions/(.+)/(.+)/
24
24
strings : contributions/1/2/ contributions/1/2/
42
42
| Output | Description |
43
43
| ------------------------------------------------------| -----------------------------------------------|
44
44
| ` groups ` | The matching groups (based on regex) |
45
+ | ` result ` | Result of the matching |
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ inputs:
11
11
outputs :
12
12
groups :
13
13
description : " The matching groups (based on regex)"
14
+ result :
15
+ description : " Result of the matching"
14
16
runs :
15
17
using : " docker"
16
18
image : " Dockerfile"
Original file line number Diff line number Diff line change 2
2
import sys
3
3
import re
4
4
5
+
5
6
def main ():
6
7
expression = os .environ ["INPUT_EXPRESSION" ]
7
8
strings = os .environ ["INPUT_STRINGS" ]
8
-
9
+
9
10
groups = None
11
+ match = None
10
12
for i in strings .split (" " ):
11
- m = re .match (expression , i )
12
- if m :
13
+ match = re .match (expression , i )
14
+ if match :
13
15
if groups is None :
14
- groups = m .groups
15
- elif groups != m .groups :
16
+ groups = match .groups ()
17
+ elif groups != match .groups () :
16
18
sys .exit ("Groups dont match" +
17
- "\n Group 1: " + str (groups () ) +
18
- "\n Group 2: " + str (m .groups ()))
19
+ "\n Group 1: " + str (groups ) +
20
+ "\n Group 2: " + str (match .groups ()))
19
21
else :
20
22
sys .exit ("String doesnt match the pattern" +
21
23
"\n String: " + i )
22
- print (f"::set-output name=groups::{ groups } " )
23
-
24
+ print (f"::set-output name=groups::{ match .groups ()} " )
25
+ print (f"::set-output name=result::{ match .group (0 )} " )
26
+
27
+
24
28
if __name__ == "__main__" :
25
29
main ()
You can’t perform that action at this time.
0 commit comments