6
6
commit_sha :
7
7
required : false
8
8
type : string
9
- description : " Commit SHA (optional)"
9
+ description : " Commit SHA (optional -- otherwise the last commit from the branch will be taken )"
10
10
11
11
workflow_call :
12
12
inputs :
@@ -30,22 +30,15 @@ jobs:
30
30
steps :
31
31
- name : Print environment variables
32
32
run : printenv
33
-
34
- - name : Set up commit SHA
35
- # "You can make an environment variable available to any subsequent steps in a workflow job by
36
- # defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
33
+
34
+ - name : Checkout repository
35
+ uses : actions/checkout@v3
36
+
37
+ - name : Check out ${{ github.event.inputs.commit_sha }} commit
38
+ if : github.event.inputs.commit_sha != ''
37
39
run : |
38
- if [ ${{ github.event.inputs.commit_sha }} != "" ]
39
- then
40
- echo COMMIT_SHA="${{ github.event.inputs.commit_sha }}" >> $GITHUB_ENV
41
- else
42
- echo COMMIT_SHA="${{ github.sha }}" >> $GITHUB_ENV
43
- fi
44
- # read more about contexts: https://docs.github.com/en/actions/learn-github-actions/contexts#about-contexts
45
- - uses : actions/checkout@v3
46
- with :
47
- ref : ${{ env.COMMIT_SHA }}
48
-
40
+ git fetch
41
+ git checkout ${{ github.event.inputs.commit_sha }}
49
42
- id : set-matrix
50
43
name : Read and print config from framework-tests-matrix.json
51
44
run : |
@@ -69,21 +62,14 @@ jobs:
69
62
- name : Print environment variables
70
63
run : printenv
71
64
72
- - name : Set up commit SHA
73
- # "You can make an environment variable available to any subsequent steps in a workflow job by
74
- # defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
75
- run : |
76
- if [ ${{ github.event.inputs.commit_sha }} != "" ]
77
- then
78
- echo COMMIT_SHA="${{ github.event.inputs.commit_sha }}" >> $GITHUB_ENV
79
- else
80
- echo COMMIT_SHA="${{ github.sha }}" >> $GITHUB_ENV
81
- fi
82
- # read more about contexts: https://docs.github.com/en/actions/learn-github-actions/contexts#about-contexts
83
- - uses : actions/checkout@v3
84
- with :
85
- ref : ${{ env.COMMIT_SHA }}
65
+ - name : Checkout repository
66
+ uses : actions/checkout@v3
86
67
68
+ - name : Check out ${{ github.event.inputs.commit_sha }} commit
69
+ if : github.event.inputs.commit_sha != ''
70
+ run : |
71
+ git fetch
72
+ git checkout ${{ github.event.inputs.commit_sha }}
87
73
- name : Run monitoring
88
74
run : |
89
75
echo Find your Prometheus metrics using label {instance=\"${GITHUB_RUN_ID}-${HOSTNAME}\"}
@@ -130,16 +116,14 @@ jobs:
130
116
- name : Print environment variables
131
117
run : printenv
132
118
133
- - name : Set up commit SHA
134
- # "You can make an environment variable available to any subsequent steps in a workflow job by
135
- # defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
119
+ - name : Checkout repository
120
+ uses : actions/checkout@v3
121
+
122
+ - name : Check out ${{ github.event.inputs.commit_sha }} commit
123
+ if : github.event.inputs.commit_sha != ''
136
124
run : |
137
- if [ ${{ github.event.inputs.commit_sha }} != "" ]
138
- then
139
- echo COMMIT_SHA="${{ github.event.inputs.commit_sha }}" >> $GITHUB_ENV
140
- else
141
- echo COMMIT_SHA="${{ github.sha }}" >> $GITHUB_ENV
142
- fi
125
+ git fetch
126
+ git checkout ${{ github.event.inputs.commit_sha }}
143
127
- uses : actions/checkout@v3
144
128
with :
145
129
ref : ${{ env.COMMIT_SHA }}
0 commit comments