Skip to content

Commit

Permalink
fix cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrybyk committed Jul 23, 2024
1 parent 62befc3 commit 3a41c5b
Show file tree
Hide file tree
Showing 6 changed files with 352 additions and 360 deletions.
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run checks
13 changes: 12 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30264,6 +30264,17 @@ const cleanupOutdatedBranches = async (ghPagesBaseDir) => {
console.error('cleanup outdated branches failed.', err);
}
};
const sortRuns = (a, b) => {
const tsA = a.split('_')[1];
const tsb = b.split('_')[1];
if (tsA < tsb) {
return -1;
}
if (tsA > tsb) {
return 1;
}
return 0;
};
const cleanupOutdatedReports = async (ghPagesBaseDir, maxReports) => {
try {
const localBranches = (await promises_.readdir(ghPagesBaseDir, { withFileTypes: true })).filter((d) => d.isDirectory()).map((d) => d.name);
Expand All @@ -30279,7 +30290,7 @@ const cleanupOutdatedReports = async (ghPagesBaseDir, maxReports) => {
.map((d) => d.name);
// run per report
if (runs.length > maxReports) {
runs.sort();
runs.sort(sortRuns);
while (runs.length > maxReports) {
await promises_.rm(external_path_.join(ghPagesBaseDir, localBranch, reportName, runs.shift()), {
recursive: true,
Expand Down
2 changes: 1 addition & 1 deletion dist/licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ Apache-2.0


convert-csv-to-json
ISC
GPL-3.0
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Expand Down
Loading

0 comments on commit 3a41c5b

Please sign in to comment.