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

Add jekyll input option #116

Merged
merged 1 commit into from Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -133,6 +133,7 @@ Following inputs can be used as `step.with` keys
| `author` | String | Author name and email address as `Display Name <joe@foo.bar>` (defaults to the GitHub Actions bot user) |
| `commit_message` | String | Commit message (default `Deploy to GitHub pages`) |
| `fqdn` | String | Write the given domain name to the CNAME file |
| `jekyll` | Bool | Allow Jekyll to build your site (default `true`) |

### environment variables

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Expand Up @@ -37,6 +37,10 @@ inputs:
fqdn:
description: 'Write the given domain name to the CNAME file'
required: false
jekyll:
description: 'Allow Jekyll to build your site'
default: 'true'
required: false

runs:
using: 'node12'
Expand Down
5 changes: 5 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/main.ts
Expand Up @@ -17,6 +17,7 @@ async function run() {
const author: string = core.getInput('author') || git.defaults.author;
const commitMessage: string = core.getInput('commit_message') || git.defaults.message;
const fqdn: string = core.getInput('fqdn');
const jekyll: boolean = /false/i.test(core.getInput('jekyll'));

if (!fs.existsSync(buildDir)) {
core.setFailed('Build dir does not exist');
Expand Down Expand Up @@ -63,6 +64,11 @@ async function run() {
await fs.writeFileSync(path.join(tmpdir, 'CNAME'), fqdn.trim());
}

if (jekyll) {
core.info(`🚫 Disabling Jekyll support via ${path.join(tmpdir, '.nojekyll')}`);
await fs.writeFileSync(path.join(tmpdir, '.nojekyll'), '');
}

const isDirty: boolean = await git.isDirty();
core.debug(`isDirty=${isDirty}`);
if (keepHistory && remoteBranchExists && !isDirty) {
Expand Down