Skip to content

Commit

Permalink
run cleanup before report (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrybyk authored Feb 8, 2024
1 parent 651291a commit 73b7fc5
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 133 deletions.
13 changes: 7 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38652,6 +38652,13 @@ try {
}
// action
await _actions_io__WEBPACK_IMPORTED_MODULE_3__.mkdirP(reportBaseDir);
// cleanup (should be before the folder listing)
if (branchCleanupEnabled) {
await (0,_src_cleanup_js__WEBPACK_IMPORTED_MODULE_7__/* .cleanupOutdatedBranches */ .B)(ghPagesBaseDir);
}
if (maxReports > 0) {
await (0,_src_cleanup_js__WEBPACK_IMPORTED_MODULE_7__/* .cleanupOutdatedReports */ .g)(ghPagesBaseDir, maxReports);
}
// process report
if (reportType === 'html') {
await _actions_io__WEBPACK_IMPORTED_MODULE_3__.cp(sourceReportDir, reportDir, { recursive: true });
Expand Down Expand Up @@ -38680,12 +38687,6 @@ try {
_actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput('report_history_url', ghPagesBaseUrl);
_actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput('run_unique_id', runUniqueId);
_actions_core__WEBPACK_IMPORTED_MODULE_1__.setOutput('report_path', reportDir);
if (branchCleanupEnabled) {
await (0,_src_cleanup_js__WEBPACK_IMPORTED_MODULE_7__/* .cleanupOutdatedBranches */ .B)(ghPagesBaseDir);
}
if (maxReports > 0) {
await (0,_src_cleanup_js__WEBPACK_IMPORTED_MODULE_7__/* .cleanupOutdatedReports */ .g)(ghPagesBaseDir, maxReports);
}
}
catch (error) {
_actions_core__WEBPACK_IMPORTED_MODULE_1__.setFailed(error.message);
Expand Down
15 changes: 8 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ try {
// action
await io.mkdirP(reportBaseDir)

// cleanup (should be before the folder listing)
if (branchCleanupEnabled) {
await cleanupOutdatedBranches(ghPagesBaseDir)
}
if (maxReports > 0) {
await cleanupOutdatedReports(ghPagesBaseDir, maxReports)
}

// process report
if (reportType === 'html') {
await io.cp(sourceReportDir, reportDir, { recursive: true })
Expand Down Expand Up @@ -99,13 +107,6 @@ try {
core.setOutput('report_history_url', ghPagesBaseUrl)
core.setOutput('run_unique_id', runUniqueId)
core.setOutput('report_path', reportDir)

if (branchCleanupEnabled) {
await cleanupOutdatedBranches(ghPagesBaseDir)
}
if (maxReports > 0) {
await cleanupOutdatedReports(ghPagesBaseDir, maxReports)
}
} catch (error) {
core.setFailed(error.message)
}
Loading

0 comments on commit 73b7fc5

Please sign in to comment.