Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gh-pages deployment cache "path" argument must be of type string undefined. #2562

Merged
merged 2 commits into from
Jul 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading