Skip to content

Commit

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

// Globally set cache folder to cwd/.cache/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');
}

if (ciTokenVar) {
const ciToken = _.isBoolean(ciTokenVar) ? 'GITHUB_TOKEN' : ciTokenVar;
if (!process.env[ciToken]) {
Expand All @@ -1406,7 +1411,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', 'gh-pages');
repoSlug = Site.extractRepoSlug(options.repo, process.env.GITHUB_REPOSITORY);

options.user = {
Expand Down

0 comments on commit 9d3e696

Please sign in to comment.