-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (40 loc) · 1.38 KB
/
conditional.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Conditional_Events_Example
on:
push:
branches:
- 'featureNA/**'
- 'mainNA'
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