@@ -188,11 +188,24 @@ const sfc = {
188
188
},
189
189
190
190
appendLogs (stepIndex , logLines , startTime ) {
191
+ // position of the client view relative to the website top
192
+ const clientHeight = document .documentElement .clientHeight + window .scrollY ;
193
+ // height of the logs container relative to the website top
194
+ const logsContainerHeight = this .$refs .stepsContainer .getBoundingClientRect ().bottom + window .scrollY ;
195
+
191
196
for (const line of logLines) {
192
197
// TODO: group support: ##[group]GroupTitle , ##[endgroup]
193
198
const el = this .getLogsContainer (stepIndex);
194
199
el .append (this .createLogLine (line, startTime, stepIndex));
195
200
}
201
+
202
+ // scrolls to the bottom if job is running and the bottom of the logs container is visible
203
+ if (! this .run .done && logLines .length > 0 ) {
204
+ if (clientHeight >= logsContainerHeight) {
205
+ const newLogsContainerHeight = this .$refs .stepsContainer .getBoundingClientRect ().bottom + window .scrollY ;
206
+ window .scrollTo ({top: clientHeight + (newLogsContainerHeight - logsContainerHeight), behavior: ' smooth' });
207
+ }
208
+ }
196
209
},
197
210
198
211
async fetchArtifacts () {
@@ -424,7 +437,7 @@ export function initRepositoryActionView() {
424
437
< / div>
425
438
< / div>
426
439
427
- < div class = " action-view-right" >
440
+ < div class = " action-view-right" ref = " stepsContainer " >
428
441
< div class = " job-info-header" >
429
442
< div class = " job-info-header-left" >
430
443
< h3 class = " job-info-header-title" >
0 commit comments