test: Add testing for set-tokens.ts (#126)

* test: remove main
* test: add getPublishRepo()
* test: Add setPersonalToken()
* test: Add setGithubToken()
* test: add showInputs()
* test: .nojekyll already exists
* test: ignore jest/expect-expect
* refactor: squash inputs log
* fix: throw error message
This commit is contained in:
Shohei Ueda
2020-03-07 00:41:30 +09:00
committed by GitHub
parent acd0462710
commit fd6e5fc7ce
9 changed files with 306 additions and 106 deletions

View File

@@ -1,7 +1,7 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import {Inputs} from './interfaces';
import {getInputs} from './get-inputs';
import {showInputs, getInputs} from './get-inputs';
import {setTokens} from './set-tokens';
import * as git from './git-utils';
import {getWorkDirName, addNoJekyll, addCNAME} from './utils';
@@ -9,6 +9,7 @@ import {getWorkDirName, addNoJekyll, addCNAME} from './utils';
export async function run(): Promise<void> {
try {
const inps: Inputs = getInputs();
showInputs(inps);
await git.setConfig(inps.UserName, inps.UserEmail);
@@ -26,7 +27,7 @@ export async function run(): Promise<void> {
try {
await exec.exec('git', ['remote', 'rm', 'origin']);
} catch (e) {
core.info(`[INFO] ${e}`);
core.info(`[INFO] ${e.message}`);
}
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
await exec.exec('git', ['add', '--all']);
@@ -43,6 +44,6 @@ export async function run(): Promise<void> {
return;
} catch (e) {
throw new Error(e);
throw new Error(e.message);
}
}