Skip to content

Commit

Permalink
Fix gh-pages deployment cache "path" argument must be of type string …
Browse files Browse the repository at this point in the history
…undefined. (#2562)

* Configure global cache

* Update Cache and Cleaning
  • Loading branch information
gerteck authored Jul 13, 2024
1 parent 54a60bf commit db8bc53
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/core/src/Site/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,13 @@ export class Site {
};
options.message = options.message.concat(' [skip ci]');

// Globally set Cache Directory to /node_modules/.cache for gh-pages
if (!process.env.CACHE_DIR || ['true', 'false', '1', '0'].includes(process.env.CACHE_DIR)) {
const cacheDirectory = path.join(this.rootPath, 'node_modules', '.cache');
fs.emptydirSync(path.join(cacheDirectory, 'gh-pages'));
process.env.CACHE_DIR = cacheDirectory;
}

if (ciTokenVar) {
const ciToken = _.isBoolean(ciTokenVar) ? 'GITHUB_TOKEN' : ciTokenVar;
if (!process.env[ciToken]) {
Expand All @@ -1406,7 +1413,7 @@ export class Site {
};
} else if (process.env.GITHUB_ACTIONS) {
// Set cache folder to a location Github Actions can find.
process.env.CACHE_DIR = path.join(process.env.GITHUB_WORKSPACE || '', 'gh-pages', '.cache');
process.env.CACHE_DIR = path.join(process.env.GITHUB_WORKSPACE || '.cache');
repoSlug = Site.extractRepoSlug(options.repo, process.env.GITHUB_REPOSITORY);

options.user = {
Expand Down

0 comments on commit db8bc53

Please sign in to comment.