File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34405,19 +34405,21 @@ const previewUpdater = async () => {
3440534405 // Authenticate
3440634406 const repo = new repository_1.Repository(config);
3440734407 await repo.authenticate();
34408- // Checkout branch
34409- const branchExists = await repo.branchExists();
34410- (0, core_1.info)(`Checkout ${branchExists ? 'existing' : 'new'} branch named "${repo.branchName()}"`);
34411- await repo.checkoutBranch(!branchExists);
3441234408 // Read file
3441334409 const content = (0, filesystem_1.readFile)(config, config.path.readme);
3441434410 const preview = (0, preview_1.setPreview)(content, config);
3441534411 if (content !== preview) {
34412+ // Checkout branch
34413+ const branchExists = await repo.branchExists();
34414+ (0, core_1.info)(`Checkout ${branchExists ? 'existing' : 'new'} branch named "${repo.branchName()}"`);
34415+ await repo.checkoutBranch(!branchExists);
34416+ // Write a file
3441634417 (0, core_1.info)(`Update readme in "${config.path.readme}" file`);
3441734418 (0, filesystem_1.writeFile)(config, config.path.readme, preview);
3441834419 }
3441934420 else {
3442034421 (0, core_1.info)(`File "${config.path.readme}" is up to date`);
34422+ return;
3442134423 }
3442234424 // Stage and commit changes
3442334425 await repo.stage();
Original file line number Diff line number Diff line change @@ -41,20 +41,23 @@ const previewUpdater = async () => {
4141 const repo = new Repository ( config )
4242 await repo . authenticate ( )
4343
44- // Checkout branch
45- const branchExists = await repo . branchExists ( )
46- info ( `Checkout ${ branchExists ? 'existing' : 'new' } branch named "${ repo . branchName ( ) } "` )
47- await repo . checkoutBranch ( ! branchExists )
48-
4944 // Read file
5045 const content = readFile ( config , config . path . readme )
5146 const preview = setPreview ( content , config )
5247
5348 if ( content !== preview ) {
49+ // Checkout branch
50+ const branchExists = await repo . branchExists ( )
51+ info ( `Checkout ${ branchExists ? 'existing' : 'new' } branch named "${ repo . branchName ( ) } "` )
52+ await repo . checkoutBranch ( ! branchExists )
53+
54+ // Write a file
5455 info ( `Update readme in "${ config . path . readme } " file` )
5556 writeFile ( config , config . path . readme , preview )
5657 } else {
5758 info ( `File "${ config . path . readme } " is up to date` )
59+
60+ return
5861 }
5962
6063 // Stage and commit changes
You can’t perform that action at this time.
0 commit comments