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

feat: Fold logs using core.startGroup() #277

Merged
merged 1 commit into from
May 4, 2020
Merged
Changes from all 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
17 changes: 16 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ import {getWorkDirName, addNoJekyll, addCNAME, skipOnFork} from './utils';
export async function run(): Promise<void> {
try {
const inps: Inputs = getInputs();
core.startGroup('Dump inputs');
showInputs(inps);
core.endGroup();

if (core.isDebug()) {
core.startGroup('Debug: dump context');
console.log(context);
core.endGroup();
}

const eventName = context.eventName;
Expand All @@ -43,17 +47,21 @@ export async function run(): Promise<void> {
}
}

core.startGroup('Setup auth token');
const remoteURL = await setTokens(inps);
core.debug(`remoteURL: ${remoteURL}`);
core.endGroup();

core.startGroup('Prepare publishing assets');
const date = new Date();
const unixTime = date.getTime();
const workDir = await getWorkDirName(`${unixTime}`);
await setRepo(inps, remoteURL, workDir);

await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
await addCNAME(workDir, inps.CNAME);
core.endGroup();

core.startGroup('Setup Git config');
try {
await exec.exec('git', ['remote', 'rm', 'origin']);
} catch (e) {
Expand All @@ -62,6 +70,9 @@ export async function run(): Promise<void> {
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
await exec.exec('git', ['add', '--all']);
await setCommitAuthor(inps.UserName, inps.UserEmail);
core.endGroup();

core.startGroup('Create a commit');
const hash = `${process.env.GITHUB_SHA}`;
const baseRepo = `${github.context.repo.owner}/${github.context.repo.repo}`;
const commitMessage = getCommitMessage(
Expand All @@ -72,8 +83,12 @@ export async function run(): Promise<void> {
hash
);
await commit(inps.AllowEmptyCommit, commitMessage);
core.endGroup();

core.startGroup('Push the commit or tag');
await push(inps.PublishBranch, inps.ForceOrphan);
await pushTag(inps.TagName, inps.TagMessage);
core.endGroup();

core.info('[INFO] Action successfully completed');

Expand Down