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 input options related to copy() #161

Merged
merged 5 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ Following inputs can be used as `step.with` keys
| `keep_history` | Bool | Create incremental commit instead of doing push force (default `false`) |
| `allow_empty_commit` | Bool | Allow an empty commit to be created (default `true`) |
| `build_dir` | String | Build directory to deploy (**required**) |
| `absolute_build_dir` | Bool | Whether to treat `build_dir` as an absolute path (defaults to `false`, making it relative to the working directory) |
| `follow_symlinks` | Bool | If enabled, the content of symbolic links will be copied (default `false`) |
| `committer` | String | Committer name and email address as `Display Name <[email protected]>` (defaults to the GitHub Actions bot user) |
| `author` | String | Author name and email address as `Display Name <[email protected]>` (defaults to the GitHub Actions bot user) |
| `commit_message` | String | Commit message (default `Deploy to GitHub pages`) |
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ inputs:
build_dir:
description: 'Build directory to deploy'
required: true
absolute_build_dir:
description: 'Whether to treat build_dir as an absolute path'
required: false
follow_symlinks:
description: 'If enabled, the content of symbolic links will be copied'
required: false
yrd marked this conversation as resolved.
Show resolved Hide resolved
committer:
description: 'The committer name and email address'
required: false
Expand Down
8 changes: 6 additions & 2 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ async function run() {
const keepHistory: boolean = /true/i.test(core.getInput('keep_history'));
const allowEmptyCommit: boolean = /true/i.test(core.getInput('allow_empty_commit'));
const buildDir: string = core.getInput('build_dir', {required: true});
const absoluteBuildDir: boolean = /true/i.test(core.getInput('absolute_build_dir'));
const followSymlinks: boolean = /true/i.test(core.getInput('follow_symlinks'));
const committer: string = core.getInput('committer') || git.defaults.committer;
const author: string = core.getInput('author') || git.defaults.author;
const commitMessage: string = core.getInput('commit_message') || git.defaults.message;
Expand Down Expand Up @@ -63,7 +65,8 @@ async function run() {

let copyCount = 0;
await core.group(`Copying ${path.join(currentdir, buildDir)} to ${tmpdir}`, async () => {
await copy(path.join(currentdir, buildDir), tmpdir, {
const sourcePath = absoluteBuildDir ? buildDir : path.join(currentdir, buildDir);
await copy(sourcePath, tmpdir, {
filter: (src, dest) => {
if (verbose) {
core.info(`${src} => ${dest}`);
Expand All @@ -75,7 +78,8 @@ async function run() {
copyCount++;
}
return true;
}
},
dereference: followSymlinks
}).catch(error => {
core.error(error);
});
Expand Down