forked from ExamProCo/Github-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c4468f
commit 1d9c978
Showing
2 changed files
with
37 additions
and
14 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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: Join issue labels | ||
if: github.event_name == 'issues' | ||
run: echo "Issue labels:${{ join(github.event.issue.labels.*.name, ', ') }}" | ||
- 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() }} | ||
- name: The job has failed | ||
if: ${{ failure() }} |