Skip to content

Commit 9bde274

Browse files
committed
sdf
1 parent dd6bad5 commit 9bde274

2 files changed

Lines changed: 35 additions & 14 deletions

File tree

.github/workflows/conditional.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Expression Functions Demo
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
expression-functions:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check if string contains substring
12+
if: contains('Hello world', 'llo')
13+
run: echo "The string contains the substring."
14+
- name: Check if string starts with
15+
if: startsWith('Hello world', 'He')
16+
run: echo "The string starts with 'He'."
17+
- name: Check if string ends with
18+
if: endsWith('Hello world', 'ld')
19+
run: echo "The string ends with 'ld'."
20+
- name: Format and echo string
21+
run: echo ${{ format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat') }}
22+
- name: Convert job context to JSON
23+
run: 'echo "Job context in JSON: ${{ toJSON(github.job) }}"'
24+
- name: Parse JSON string
25+
run: |
26+
echo "Parsed JSON: ${{ fromJSON('{\"hello\":\"world\"}').hello }}"
27+
- name: Hash files
28+
run: |
29+
echo "Hash of files: ${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}"
30+
- name: The job has succeeded
31+
if: ${{ success() }}
32+
run: echo "The job succeeded."
33+
- name: The job has failed
34+
if: ${{ failure() }}
35+
run: echo "The job failed."

0 commit comments

Comments
 (0)