-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Don't commit coverage directory (#35)
- Loading branch information
1 parent
e411b2e
commit 3211e3e
Showing
3 changed files
with
59 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
f | ||
fabf | ||
fabf | ||
fabf | ||
fabd | ||
sliders | ||
dartf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113816,27 +113816,45 @@ const push = async (coverageDirectory) => { | |
console.error("Unable to check if there are changes", e); | ||
} | ||
(0, core_1.endGroup)(); | ||
/// If `stdout` is empty, there are no changes | ||
if (stdout != "") { | ||
(0, core_1.startGroup)("Parse changes and remove coverage directory"); | ||
const changes = stdout.split("\n").filter((line) => line.trim() !== ""); | ||
if (changes.length === 1 && changes[0].includes(coverageDirectory)) { | ||
changes.pop(); | ||
} | ||
(0, core_1.endGroup)(); | ||
if (changes.length > 0) { | ||
try { | ||
(0, core_1.startGroup)("Push changes"); | ||
(0, core_1.startGroup)("Set up git"); | ||
await (0, exec_1.exec)('git config --global user.name "github-actions"'); | ||
await (0, exec_1.exec)('git config --global user.email "[email protected]"'); | ||
await (0, exec_1.exec)(`git add -A -- ':!${coverageDirectory}'`); | ||
(0, core_1.endGroup)(); | ||
try { | ||
(0, core_1.startGroup)("Stage files"); | ||
await (0, exec_1.exec)(`git add -A -- :!${coverageDirectory}/`); | ||
await (0, exec_1.exec)(`git add -A -- :!${coverageDirectory}/*`); | ||
} | ||
catch (e) { | ||
console.error("Unable to add files", e); | ||
} | ||
finally { | ||
(0, core_1.endGroup)(); | ||
} | ||
(0, core_1.startGroup)("Commit changes"); | ||
(0, child_process_1.execSync)(`git commit -m 'chore(automated): Lint commit and format' `); | ||
(0, core_1.endGroup)(); | ||
(0, core_1.startGroup)("Push changes"); | ||
await (0, exec_1.exec)("git push -f"); | ||
(0, core_2.debug)("Changes pushed onto branch"); | ||
(0, core_1.endGroup)(); | ||
} | ||
catch (e) { | ||
console.error("Unable to push changes", e); | ||
(0, core_1.setFailed)("Unable to push changes to branch"); | ||
} | ||
finally { | ||
(0, core_1.endGroup)(); | ||
} | ||
} | ||
}; | ||
exports.push = push; | ||
(0, exports.push)(".coverage"); | ||
|
||
|
||
/***/ }), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import { endGroup, setFailed, setOutput, startGroup } from "@actions/core"; | |
import { exec } from "@actions/exec"; | ||
import { execSync } from "child_process"; | ||
import { debug } from "@actions/core"; | ||
import { start } from "repl"; | ||
|
||
/** | ||
* Push changes to the branch | ||
|
@@ -17,22 +18,42 @@ export const push = async (coverageDirectory: string) => { | |
console.error("Unable to check if there are changes", e); | ||
} | ||
endGroup(); | ||
startGroup("Parse changes and remove coverage directory"); | ||
const changes = stdout.split("\n").filter((line) => line.trim() !== ""); | ||
if (changes.length === 1 && changes[0].includes(coverageDirectory)) { | ||
changes.pop(); | ||
} | ||
endGroup(); | ||
|
||
/// If `stdout` is empty, there are no changes | ||
if (stdout != "") { | ||
if (changes.length > 0) { | ||
try { | ||
startGroup("Push changes"); | ||
startGroup("Set up git"); | ||
await exec('git config --global user.name "github-actions"'); | ||
await exec('git config --global user.email "[email protected]"'); | ||
await exec(`git add -A -- ':!${coverageDirectory}'`); | ||
endGroup(); | ||
|
||
try { | ||
startGroup("Stage files"); | ||
await exec(`git add -A -- :!${coverageDirectory}/`); | ||
await exec(`git add -A -- :!${coverageDirectory}/*`); | ||
} catch (e) { | ||
console.error("Unable to add files", e); | ||
} finally { | ||
endGroup(); | ||
} | ||
startGroup("Commit changes"); | ||
execSync(`git commit -m 'chore(automated): Lint commit and format' `); | ||
endGroup(); | ||
startGroup("Push changes"); | ||
await exec("git push -f"); | ||
|
||
debug("Changes pushed onto branch"); | ||
endGroup(); | ||
} catch (e) { | ||
console.error("Unable to push changes", e); | ||
setFailed("Unable to push changes to branch"); | ||
} finally { | ||
endGroup(); | ||
} | ||
} | ||
}; | ||
|
||
push(".coverage"); |