File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : " Check file"
2
+ description : " Check file for expected changes."
3
+ inputs :
4
+ file :
5
+ description : " File to search."
6
+ required : true
7
+ search :
8
+ description : " Grep pattern to search."
9
+ required : true
10
+ runs :
11
+ using : composite
12
+ steps :
13
+ - shell : bash
14
+ env :
15
+ FILE : ${{ inputs.file }}
16
+ SEARCH : ${{ inputs.search }}
17
+ run : |
18
+ echo "Check that all required env variables are set"
19
+ if [ -z "$FILE" ]
20
+ then
21
+ echo "FILE is unset or set to the empty string"
22
+ exit 1
23
+ fi
24
+ if [ -z "$SEARCH" ]
25
+ then
26
+ echo "SEARCH is unset or set to the empty string"
27
+ exit 1
28
+ fi
29
+
30
+ # Make sure to escape your backslashes => \\ <= in YAML
31
+ # So that its still a single \ in bash
32
+
33
+ echo "Check that $FILE includes $SEARCH"
34
+ if grep --extended-regexp "$SEARCH" -- $FILE
35
+ then
36
+ echo "Found $SEARCH in $FILE"
37
+ else
38
+ echo "Missing $SEARCH in $FILE"
39
+ echo "----------------"
40
+ echo "$(cat $FILE)"
41
+ exit 204 # We're sending a weird code so it looks different from other "failures"
42
+ fi
You can’t perform that action at this time.
0 commit comments