4
4
push :
5
5
branches :
6
6
- main
7
- issues :
8
- types : [opened, labeled]
9
7
10
8
jobs :
11
9
expression-functions :
@@ -14,24 +12,35 @@ jobs:
14
12
- name : Check if string contains substring
15
13
if : contains('Hello world', 'llo')
16
14
run : echo "The string contains the substring."
15
+
17
16
- name : Check if string starts with
18
17
if : startsWith('Hello world', 'He')
19
18
run : echo "The string starts with 'He'."
19
+
20
20
- name : Check if string ends with
21
21
if : endsWith('Hello world', 'ld')
22
22
run : echo "The string ends with 'ld'."
23
+
23
24
- name : Format and echo string
24
- run : cat ${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }}
25
+ run : echo "${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }}"
26
+
25
27
- name : Join issue labels
26
28
if : github.event_name == 'issues'
27
- run : cat "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}"
29
+ run : echo "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}"
30
+
28
31
- name : Convert job context to JSON
29
- run : cat "Job context in JSON: ${{ toJSON(github.job) }}"
32
+ run : echo "Job context in JSON: ${{ toJSON(github.job) }}"
33
+
30
34
- name : Parse JSON string
31
- run : cat "Parsed JSON: ${{ fromJSON('{"hello":"world"}').hello }}"
35
+ run : echo "Parsed JSON: ${{ fromJSON('{\"hello\":\"world\"}').hello }}"
36
+
32
37
- name : Hash files
33
- run : cat "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}
38
+ run : echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}"
39
+
34
40
- name : The job has succeeded
35
41
if : ${{ success() }}
42
+ run : echo "The job succeeded!"
43
+
36
44
- name : The job has failed
37
- if : ${{ failure() }}
45
+ if : ${{ failure() }}
46
+ run : echo "The job failed!"
0 commit comments