File tree Expand file tree Collapse file tree 2 files changed +23
-9
lines changed
Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,18 @@ module.exports = {
3636 async function uploadChanges ( itemRemoved ) {
3737 try {
3838 // Check if there are any updates to the repo then pull
39- await git . add ( '../' ) ;
40- await git . commit ( 'Stashing changes before pull' ) ;
41- await git . stash ( ) ;
39+ const status = await git . status ( ) ;
40+ if ( status . files . length > 0 ) {
41+ await git . add ( '../' ) ;
42+ await git . commit ( 'Stashing changes before pull' ) ;
43+ await git . stash ( ) ;
44+ }
45+
4246 await git . pull ( 'origin' , process . env . GIT_BRANCH ) ;
43- await git . stash ( [ 'pop' ] ) ;
47+
48+ if ( status . files . length > 0 ) {
49+ await git . stash ( [ 'pop' ] ) ;
50+ }
4451
4552 // Add changes, commit, and push
4653 await git . add ( '../' ) ;
Original file line number Diff line number Diff line change @@ -76,12 +76,19 @@ module.exports = {
7676 async function uploadChanges ( itemRemoved ) {
7777 try {
7878 // Check if there are any updates to the repo then pull
79- await git . add ( '../' ) ;
80- await git . commit ( 'Stashing changes before pull' ) ;
81- await git . stash ( ) ;
79+ const status = await git . status ( ) ;
80+ if ( status . files . length > 0 ) {
81+ await git . add ( '../' ) ;
82+ await git . commit ( 'Stashing changes before pull' ) ;
83+ await git . stash ( ) ;
84+ }
85+
8286 await git . pull ( 'origin' , process . env . GIT_BRANCH ) ;
83- await git . stash ( [ 'pop' ] ) ;
84-
87+
88+ if ( status . files . length > 0 ) {
89+ await git . stash ( [ 'pop' ] ) ;
90+ }
91+
8592 await git . add ( '../' ) ;
8693 await git . commit ( `Added ${ itemRemoved } to the wishlist` ) ;
8794 await git . push ( 'origin' , process . env . GIT_BRANCH ) ;
You can’t perform that action at this time.
0 commit comments