Don't cache non-existent Zig cache directory
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
const fs = require('fs').promises;
|
||||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
const cache = require('@actions/cache');
|
||||
@@ -6,9 +7,20 @@ const common = require('./common');
|
||||
async function main() {
|
||||
try {
|
||||
if (core.getBooleanInput('use-cache')) {
|
||||
const prefix = await common.getCachePrefix();
|
||||
const name = prefix + github.context.runId;
|
||||
await cache.saveCache([await common.getZigCachePath()], name);
|
||||
const cache_path = await common.getZigCachePath();
|
||||
|
||||
let accessible = true;
|
||||
try {
|
||||
await fs.access(cache_path, fs.constants.R_OK);
|
||||
} catch {
|
||||
accessible = false;
|
||||
}
|
||||
|
||||
if (accessible) {
|
||||
const prefix = await common.getCachePrefix();
|
||||
const name = prefix + github.context.runId;
|
||||
await cache.saveCache([cache_path], name);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
core.setFailed(err.message);
|
||||
|
||||
Reference in New Issue
Block a user