Review some inputs

This commit is contained in:
CrazyMax 2019-11-06 03:10:09 +01:00
parent 0bbea585a5
commit acd6b53b3f
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
4 changed files with 14 additions and 17 deletions

View File

@ -64,9 +64,9 @@ Following inputs can be used as `step.with` keys
|-----------------|---------|-------------------------------------------------------------------|
| `repo` | String | GitHub repository where assets will be deployed (default current) |
| `target_branch` | String | Git branch where assets will be deployed (default `gh-pages`) |
| `build_dir` | String | Build directory to deploy **required** |
| `comitter_name` | String | Commit author's name (default [GITHUB_ACTOR](https://help.github.com/en/github/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables))|
| `comitter_email`| String | Commit author's email (default `GITHUB_ACTOR@users.noreply.github.com`)|
| `build_dir` | String | Build directory to deploy (**required**) |
| `commit_name` | String | Commit author's name (default [GITHUB_ACTOR](https://help.github.com/en/github/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables) or `github-actions`) |
| `commit_email` | String | Commit author's email (default `<committer_name>@users.noreply.github.com`) |
| `commit_message`| String | Commit message (default `Deploy to GitHub pages`) |
### environment variables

View File

@ -16,14 +16,11 @@ inputs:
description: 'Build directory to deploy'
required: true
comitter_name:
description: 'Name of the commit author'
default: '<GITHUB_ACTOR>'
description: 'Commit author''s name'
comitter_email:
description: 'Email of the commit author'
default: '<GITHUB_ACTOR>@users.noreply.github.com'
description: 'Commit author''s email'
commit_message:
description: 'Commit description'
default: 'Deploy to GitHub pages'
description: 'Commit message'
runs:
using: 'node12'

View File

@ -26,8 +26,8 @@ function run() {
const repo = core.getInput('repo') || process.env['GITHUB_REPOSITORY'] || '';
const target_branch = core.getInput('target_branch') || 'gh-pages';
const build_dir = core.getInput('build_dir', { required: true });
const comitter_name = core.getInput('comitter_name') || process.env['GITHUB_ACTOR'] || 'github-actions';
const comitter_email = core.getInput('comitter_email') || `${comitter_name}@users.noreply.github.com`;
const commit_name = core.getInput('commit_name') || process.env['GITHUB_ACTOR'] || 'github-actions';
const commit_email = core.getInput('commit_email') || `${commit_name}@users.noreply.github.com`;
const commit_message = core.getInput('commit_message') || 'Deploy to GitHub pages';
if (!fs.existsSync(build_dir)) {
core.setFailed('⛔️ Build dir does not exist');
@ -36,8 +36,8 @@ function run() {
core.info(`🏃 Deploying ${build_dir} directory to ${target_branch} branch on ${repo} repo`);
process.chdir(build_dir);
yield exec.exec('git', ['init']);
yield exec.exec('git', ['config', 'user.name', comitter_name]);
yield exec.exec('git', ['config', 'user.email', comitter_email]);
yield exec.exec('git', ['config', 'user.name', commit_name]);
yield exec.exec('git', ['config', 'user.email', commit_email]);
try {
child_process.execSync('git status --porcelain').toString();
}

View File

@ -8,8 +8,8 @@ async function run() {
const repo = core.getInput('repo') || process.env['GITHUB_REPOSITORY'] || '';
const target_branch = core.getInput('target_branch') || 'gh-pages';
const build_dir = core.getInput('build_dir', {required: true});
const comitter_name = core.getInput('comitter_name') || process.env['GITHUB_ACTOR'] || 'github-actions';
const comitter_email = core.getInput('comitter_email') || `${comitter_name}@users.noreply.github.com`;
const commit_name = core.getInput('commit_name') || process.env['GITHUB_ACTOR'] || 'github-actions';
const commit_email = core.getInput('commit_email') || `${commit_name}@users.noreply.github.com`;
const commit_message = core.getInput('commit_message') || 'Deploy to GitHub pages';
if (!fs.existsSync(build_dir)) {
@ -21,8 +21,8 @@ async function run() {
process.chdir(build_dir);
await exec.exec('git', ['init']);
await exec.exec('git', ['config', 'user.name', comitter_name]);
await exec.exec('git', ['config', 'user.email', comitter_email]);
await exec.exec('git', ['config', 'user.name', commit_name]);
await exec.exec('git', ['config', 'user.email', commit_email]);
try {
child_process.execSync('git status --porcelain').toString();