@@ -113816,36 +113816,41 @@ const push = async (coverageDirectory) => {
113816113816        console.error("Unable to check if there are changes", e);
113817113817    }
113818113818    (0, core_1.endGroup)();
113819+     (0, core_1.startGroup)("Parse changes and remove coverage directory");
113819113820    const changes = stdout.split("\n").filter((line) => line.trim() !== "");
113820-     /// If `stdout` is empty, there are no changes
113821-     console.log(changes);
113822-     if (stdout != "") {
113821+     if (changes.length === 1 && changes[0].includes(coverageDirectory)) {
113822+         changes.pop();
113823+     }
113824+     (0, core_1.endGroup)();
113825+     if (changes.length > 0) {
113823113826        try {
113824-             (0, core_1.startGroup)("Push changes ");
113827+             (0, core_1.startGroup)("Set up git ");
113825113828            await (0, exec_1.exec)('git config --global user.name "github-actions"');
113826113829            await (0, exec_1.exec)('git config --global user.email "
[email protected] "');
113830+             (0, core_1.endGroup)();
113827113831            try {
113828-                 await (0, exec_1.exec)(`git add -A -- ':!/${coverageDirectory}/*'`);
113832+                 (0, core_1.startGroup)("Stage files");
113833+                 await (0, exec_1.exec)(`git add -A -- :!${coverageDirectory}/`);
113834+                 await (0, exec_1.exec)(`git add -A -- :!${coverageDirectory}/*`);
113829113835            }
113830113836            catch (e) {
113831-                 try {
113832-                     await (0, exec_1.exec)(`git add -A -- :!/${coverageDirectory}/*`);
113833-                 }
113834-                 catch (e) {
113835-                     console.error("Unable to add files", e);
113836-                 }
113837+                 console.error("Unable to add files", e);
113837113838            }
113839+             finally {
113840+                 (0, core_1.endGroup)();
113841+             }
113842+             (0, core_1.startGroup)("Commit changes");
113838113843            (0, child_process_1.execSync)(`git commit -m 'chore(automated): Lint commit and format' `);
113844+             (0, core_1.endGroup)();
113845+             (0, core_1.startGroup)("Push changes");
113839113846            await (0, exec_1.exec)("git push -f");
113840113847            (0, core_2.debug)("Changes pushed onto branch");
113848+             (0, core_1.endGroup)();
113841113849        }
113842113850        catch (e) {
113843113851            console.error("Unable to push changes", e);
113844113852            (0, core_1.setFailed)("Unable to push changes to branch");
113845113853        }
113846-         finally {
113847-             (0, core_1.endGroup)();
113848-         }
113849113854    }
113850113855};
113851113856exports.push = push;
0 commit comments