-
Notifications
You must be signed in to change notification settings - Fork 1.2k
36 lines (34 loc) · 1.21 KB
/
expression-functions.yml
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
name: Expression Functions Demo
on:
push:
branches:
- main
issues:
types: [opened, labeled]
jobs:
expression-functions:
runs-on: ubuntu-latest
steps:
- name: Check if string contains substring
if: contains('Hello world', 'llo')
run: echo "The string contains the substring."
- name: Check if string starts with
if: startsWith('Hello world', 'He')
run: echo "The string starts with 'He'."
- name: Check if string ends with
if: endsWith('Hello world', 'ld')
run: echo "The string ends with 'ld'."
- name: Format and echo string
run: echo ${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }}
- name: Convert job context to JSON
run: "echo \"Job context in JSON: ${{ toJSON(github.job) }}\""
- name: Parse JSON string
run: "echo \"Parsed JSON: ${{ fromJSON('{"\hello\":\"world\"}').hello }}\""
- name: Hash files
run: "echo \"Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}\""
- name: The job has succeeded
if: ${{ success() }}
run: echo "SUCCESS!"
- name: The job has failed
if: ${{ failure() }}
run: echo "Failure!"