File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ import text from './text';
8
8
const PR_NUMBER = parseInt ( process . env . PR_NUMBER || '0' , 10 ) ;
9
9
const FOLDERS_TO_CHECK = 'yarn.lock openapitools.json clients specs/bundled' ;
10
10
11
+ async function isUpToDate ( ) : Promise < boolean > {
12
+ await run ( 'git fetch origin' ) ;
13
+ return ( await run ( 'git status' ) ) . includes ( 'Your branch is up to date with' ) ;
14
+ }
15
+
11
16
/**
12
17
* Push generated code for the current `JOB` and `CLIENT` on a `generated/` branch.
13
18
*/
@@ -50,6 +55,13 @@ export async function pushGeneratedCode(): Promise<void> {
50
55
await run ( `git checkout -b ${ branchToPush } ` ) ;
51
56
}
52
57
58
+ if ( ! ( await isUpToDate ( ) ) ) {
59
+ console . log (
60
+ `The branch ${ branchToPush } is not up to date with ${ baseBranch } , stopping this task and letting the new job push generated code.`
61
+ ) ;
62
+ return ;
63
+ }
64
+
53
65
const commitMessage = await run ( `git show -s ${ baseBranch } --format="${
54
66
text . commitStartMessage
55
67
} %H. ${ isMainBranch ? '[skip ci]' : '' }
You can’t perform that action at this time.
0 commit comments