Skip to content

Workflow file for this run

name: Conditional_Events_Example
on:
push:
branches:
- 'feature/**'
- 'main'
pull_request:
branches: [ $default-branch ]
jobs:
Check1:
if: ${{github.repository == 'octo-org/octo-repo-prod'}} # this will evaluate to false
runs-on: ubuntu-latest
steps:
- name: Echo Basic Information
run: |
echo "Ref: $GITHUB_REF" >> ./basic_info.txt
echo "Job Id: $GITHUB_JOB" >> ./basic_info.txt
echo "Action: $GITHUB_ACTION" >> ./basic_info.txt
echo "Actor: $GITHUB_ACTOR" >> ./basic_info.txt
cat ./basic_info.txt
Check2:
if: ${{github.repository != 'octo-org/octo-repo-prod'}} # this will evaluate to true
runs-on: ubuntu-latest
steps:
- name: Echo Basic Information
run: |
echo "Ref: $GITHUB_REF" >> ./basic_info.txt
echo "Job Id: $GITHUB_JOB" >> ./basic_info.txt
echo "Action: $GITHUB_ACTION" >> ./basic_info.txt
echo "Actor: $GITHUB_ACTOR" >> ./basic_info.txt
cat ./basic_info.txt
Check3:
if: ${{github.repository == 'xenon-92/smotw'}} # this will evaluate to true
runs-on: alpine-latest
needs: [Check2] # this Job is dependent upon Job.<Job_ID> === Check2
steps:
- name: Echo Basic Information
run: |
ls -la > ./file_list.txt
cat ./file_list.txt