Skip to content

Commit

Permalink
Update Cache and Cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
gerteck committed Jul 9, 2024
1 parent 9d3e696 commit 5b19c72
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/core/src/Site/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1382,9 +1382,11 @@ export class Site {
};
options.message = options.message.concat(' [skip ci]');

// Globally set cache folder to cwd/.cache/gh-pages.
// 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)) {
process.env.CACHE_DIR = path.join(process.cwd(), '.cache', 'gh-pages');
const cacheDirectory = path.join(this.rootPath, 'node_modules', '.cache');
fs.emptydirSync(path.join(cacheDirectory, 'gh-pages'));
process.env.CACHE_DIR = cacheDirectory;
}

if (ciTokenVar) {
Expand All @@ -1411,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 || '.cache', 'gh-pages');
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 5b19c72

Please sign in to comment.