|
4 | 4 | ApplicationState,
|
5 | 5 | WorkflowPublisherPayload,
|
6 | 6 | } from '@amazeelabs/publisher-shared';
|
7 |
| -import { pairwise } from 'rxjs'; |
8 | 7 |
|
9 | 8 | import { getConfigGithubWorkflow as config } from '../tools/config';
|
10 | 9 | import { saveBuildInfo } from '../tools/database';
|
@@ -107,27 +106,23 @@ async function runWorkflow(args: {
|
107 | 106 | }
|
108 | 107 |
|
109 | 108 | const subscription = core.state.workflowState$
|
110 |
| - .pipe(pairwise()) |
111 |
| - .subscribe(([previous, current]) => { |
112 |
| - if (current === 'started') { |
| 109 | + .subscribe((state) => { |
| 110 | + if (state === 'started') { |
113 | 111 | core.output$.next('Workflow started', 'info');
|
114 | 112 | core.output$.next('Logs: ' + core.state.workflowRunUrl);
|
115 | 113 | return;
|
116 | 114 | }
|
117 |
| - if ( |
118 |
| - previous === 'started' && |
119 |
| - (current === 'success' || current === 'failure') |
120 |
| - ) { |
| 115 | + if (state === 'success' || state === 'failure') { |
121 | 116 | subscription.unsubscribe();
|
122 |
| - if (current === 'success') { |
| 117 | + if (state === 'success') { |
123 | 118 | core.output$.next('Workflow succeeded', 'success');
|
124 | 119 | } else {
|
125 | 120 | core.output$.next('Workflow failed or cancelled', 'error');
|
126 | 121 | }
|
127 | 122 | core.output$.next('Logs: ' + core.state.workflowRunUrl);
|
128 | 123 |
|
129 | 124 | clearTimeout(timeout);
|
130 |
| - return resolve(current === 'success'); |
| 125 | + return resolve(state === 'success'); |
131 | 126 | }
|
132 | 127 | });
|
133 | 128 | });
|
|
0 commit comments