Skip to content

Commit

Permalink
feat(action): pretty log
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwa committed May 15, 2021
1 parent e6e8782 commit 6956ac3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15528,8 +15528,10 @@ function main() {
const remoteOrigin = `https://${username}:${token}@github.com/${username}/${repoName}.git`;
const outFilePath = (docsDir.endsWith('/') ? docsDir : `${docsDir}/`) +
(/\.mdx?$/.test(outFile) ? outFile : `${outFile}.md`);
(0,core.debug)('Entire output file path: ' + outFilePath);
(0,core.startGroup)('Create local file');
yield lib_default().outputFile(outFilePath, content);
(0,core.info)(`${outFile} has been created in ${outFilePath}`);
(0,core.endGroup)();
if (username) {
yield git.addConfig('user.email', `${username}@users.noreply.github.com`);
}
Expand All @@ -15538,6 +15540,7 @@ function main() {
.add('.')
.commit('docs: YuQue sync ')
.push(remoteOrigin);
(0,core.info)(`New data is available in the ${username}/${repoName}/${outFilePath}`);
});
}

Expand Down
11 changes: 7 additions & 4 deletions src/action.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getInput, debug } from '@actions/core'
import { getInput, info, startGroup, endGroup } from '@actions/core'
import * as github from '@actions/github'
import fs from 'fs-extra'
import createGitCli from 'simple-git'
Expand Down Expand Up @@ -27,9 +27,10 @@ export async function main() {
(docsDir.endsWith('/') ? docsDir : `${docsDir}/`) +
(/\.mdx?$/.test(outFile) ? outFile : `${outFile}.md`)

// debug is only output if you set the secret `ACTIONS_RUNNER_DEBUG` to true
debug('Entire output file path: ' + outFilePath)
startGroup('Create local file')
await fs.outputFile(outFilePath, content)
info(`New data is available in the ${username}/${repoName}/${outFilePath}`)
endGroup()

if (username) {
await git.addConfig('user.email', `${username}@users.noreply.github.com`)
Expand All @@ -38,6 +39,8 @@ export async function main() {
await git
.addConfig('user.name', username)
.add('.')
.commit('docs: YuQue sync ')
.commit('docs: sync data from yuque.com')
.push(remoteOrigin)

info(`New data has been uploaded to remote git.`)
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"extends": "@lbwa/tsconfig",
"compilerOptions": {
"outDir": "dist" /* Redirect output structure to the directory. */,
"tsBuildInfoFile": "dist/.tsBuildInfoFile" /* Specify file to store incremental compilation information */,
"incremental": false,
"removeComments": true /* Do not emit comments to output. */
}
}

0 comments on commit 6956ac3

Please sign in to comment.