Last active
January 14, 2023 13:07
-
-
Save parjun8840/52ac294032a2bf530b8d6cb57020fe21 to your computer and use it in GitHub Desktop.
functions demo for GitHub
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
-------"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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updating gist