Skip to content

Instantly share code, notes, and snippets.

@parjun8840
Last active January 14, 2023 13:07
Show Gist options
  • Save parjun8840/52ac294032a2bf530b8d6cb57020fe21 to your computer and use it in GitHub Desktop.
Save parjun8840/52ac294032a2bf530b8d6cb57020fe21 to your computer and use it in GitHub Desktop.
functions demo for GitHub
-------"status-function-checks" Job will run only on pull_request------
name: functions check worfkflow
on: [push, pull_request]
jobs:
general-function-checks:
runs-on: ubuntu-latest
steps:
- name: print GitHub context
run: echo "${{ toJson(github) }}"
status-function-checks:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: print username
run: echo ${GITHUB_ACTOR}
- name: Failing step
id: demo
run: exit 1
- name: print runner context
if: failure()
run: echo "${{ toJson(runner) }}"
- name: print hello always
if: always()
run: echo hello
~
---------Modify the "status-function-checks" Job to run on push--------
on: [push, pull_request]
jobs:
general-function-checks:
runs-on: ubuntu-latest
steps:
- name: print GitHub context
run: echo "${{ toJson(github) }}"
status-function-checks:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: print username
run: echo ${GITHUB_ACTOR}
- name: Failing step
id: demo
run: exit 1
- name: print runner context
if: failure()
run: echo "${{ toJson(runner) }}"
- name: print hello always
if: always()
run: echo hello
@parjun8840
Copy link
Author

updating gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment