feat: Add .nojekyll file by default for all branches (#438)

This commit is contained in:
Shohei Ueda
2020-08-02 15:11:20 +09:00
committed by GitHub
parent 4fb3d60161
commit 079d48367e
3 changed files with 12 additions and 68 deletions

View File

@@ -48,7 +48,7 @@ export async function run(): Promise<void> {
const unixTime = date.getTime();
const workDir = await getWorkDirName(`${unixTime}`);
await setRepo(inps, remoteURL, workDir);
await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
await addNoJekyll(workDir, inps.DisableNoJekyll);
await addCNAME(workDir, inps.CNAME);
core.endGroup();

View File

@@ -29,22 +29,16 @@ export async function createDir(dirPath: string): Promise<void> {
return;
}
export async function addNoJekyll(
workDir: string,
DisableNoJekyll: boolean,
PublishBranch: string
): Promise<void> {
export async function addNoJekyll(workDir: string, DisableNoJekyll: boolean): Promise<void> {
if (DisableNoJekyll) {
return;
}
if (PublishBranch === 'master' || PublishBranch === 'gh-pages') {
const filepath = path.join(workDir, '.nojekyll');
if (fs.existsSync(filepath)) {
return;
}
fs.closeSync(fs.openSync(filepath, 'w'));
core.info(`[INFO] Created ${filepath}`);
const filepath = path.join(workDir, '.nojekyll');
if (fs.existsSync(filepath)) {
return;
}
fs.closeSync(fs.openSync(filepath, 'w'));
core.info(`[INFO] Created ${filepath}`);
}
export async function addCNAME(workDir: string, content: string): Promise<void> {