Skip to content

Commit

Permalink
feat: add debug messages for better diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
BD103 committed Oct 30, 2024
1 parent bffbc9d commit 16ba137
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27598,6 +27598,8 @@ async function locateTarget(manifestPath) {
// Destroy the stream, just in case it wasn't done so already.
outStream.destroy();

core.debug(`Executing \`cargo locate-project\` resulted in the following \`stdout\`: ${lines}`);

// From the path to `Cargo.toml`, return the path to `target`.
return path.join(lines[1], "../", "target");
}
Expand All @@ -27622,13 +27624,21 @@ async function main() {
// amount of space. Additionally, skip certain whitelisted files where it wouldn't make
// sense to delete them.
if (stat.isDirectory() || SKIPPED_FILES.includes(file)) {
core.debug(`Skipped ${filePath} because it is a directory or is whitelisted.`);
continue;
}

// If the file's last access time is older than the timestamp, delete it.
if (stat.atime.getTime() < stamp) {
core.info(`Deleting ${filePath}.`);
if (core.isDebug()) {
core.info(`Deleting ${filePath} with \`atime\` of ${stat.atime}.`);
} else {
core.info(`Deleting ${filePath}.`);
}

await fs.rm(filePath);
} else {
core.debug(`Skipped ${filePath} because it was accessed after timestamp.`);
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion src/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ async function locateTarget(manifestPath) {
// Destroy the stream, just in case it wasn't done so already.
outStream.destroy();

core.debug(`Executing \`cargo locate-project\` resulted in the following \`stdout\`: ${lines}`);

// From the path to `Cargo.toml`, return the path to `target`.
return path.join(lines[1], "../", "target");
}
Expand All @@ -73,13 +75,21 @@ async function main() {
// amount of space. Additionally, skip certain whitelisted files where it wouldn't make
// sense to delete them.
if (stat.isDirectory() || SKIPPED_FILES.includes(file)) {
core.debug(`Skipped ${filePath} because it is a directory or is whitelisted.`);
continue;
}

// If the file's last access time is older than the timestamp, delete it.
if (stat.atime.getTime() < stamp) {
core.info(`Deleting ${filePath}.`);
if (core.isDebug()) {
core.info(`Deleting ${filePath} with \`atime\` of ${stat.atime}.`);
} else {
core.info(`Deleting ${filePath}.`);
}

await fs.rm(filePath);
} else {
core.debug(`Skipped ${filePath} because it was accessed after timestamp.`);
}
}
}
Expand Down

0 comments on commit 16ba137

Please sign in to comment.