From db3e60d230c7ebcd5342990f0ffc5af0ed1f4296 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Mon, 4 May 2020 10:23:22 +0900 Subject: [PATCH] feat: Fold logs using core.startGroup() (#277) cf. https://github.com/actions/toolkit/blob/master/docs/commands.md --- src/main.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index d136ae0aa..e9e965cac 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,10 +18,14 @@ import {getWorkDirName, addNoJekyll, addCNAME, skipOnFork} from './utils'; export async function run(): Promise { 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; @@ -43,17 +47,21 @@ export async function run(): Promise { } } + 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) { @@ -62,6 +70,9 @@ export async function run(): Promise { 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( @@ -72,8 +83,12 @@ export async function run(): Promise { 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');