mirror of
https://code.forgejo.org/actions/setup-go
synced 2025-06-15 23:04:10 +02:00
fix(cache): Not throw err if no cache folders
This commit is contained in:
parent
be45b2722d
commit
5547b9ed8d
2 changed files with 17 additions and 18 deletions
|
@ -16,7 +16,14 @@ export async function run() {
|
|||
try {
|
||||
await cachePackages();
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
let message = 'Unknown error!';
|
||||
if (error instanceof Error) {
|
||||
message = error.message;
|
||||
}
|
||||
if (typeof error === 'string') {
|
||||
message = error;
|
||||
}
|
||||
core.setFailed(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,9 +48,7 @@ const cachePackages = async () => {
|
|||
|
||||
if (nonExistingPaths.length === cachePaths.length) {
|
||||
core.warning(`There are no cache folders on the disk`);
|
||||
logWarning(`There are no cache folders on the disk`)
|
||||
return;
|
||||
throw new Error(`There are no cache folders on the disk`);
|
||||
}
|
||||
|
||||
if (nonExistingPaths.length) {
|
||||
|
@ -68,7 +73,7 @@ const cachePackages = async () => {
|
|||
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||
};
|
||||
|
||||
export function logWarning(message: string): void {
|
||||
function logWarning(message: string): void {
|
||||
const warningPrefix = '[warning]';
|
||||
core.info(`${warningPrefix}${message}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue