Skip to content

Commit

Permalink
fix(action): ensure dir slash
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwa committed May 15, 2021
1 parent 6289b12 commit 3438d60
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 3 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15526,20 +15526,18 @@ function main() {
const username = github.context.actor || github.context.repo.owner;
const repoName = github.context.repo.repo;
const remoteOrigin = `https://${username}:${token}@github.com/${username}/${repoName}.git`;
const outFilePath = docsDir + (/\.mdx?$/.test(outFile) ? outFile : `${outFile}.md`);
console.log(`git remote: ${remoteOrigin}`);
const outFilePath = (docsDir.endsWith('/') ? docsDir : `${docsDir}/`) +
(/\.mdx?$/.test(outFile) ? outFile : `${outFile}.md`);
(0,core.debug)('Entire output file path: ' + outFilePath);
yield lib_default().outputFile(outFilePath, content);
if (username) {
yield git.addConfig('user.email', `${username}@users.noreply.github.com`);
}
const res = yield git
.status()
yield git
.addConfig('user.name', username)
.add('.')
.commit('docs: YuQue sync ')
.push(remoteOrigin);
console.log(`res`, res);
});
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"build": "ncc build src/index.ts -o dist",
"watch": "tsc -p tsconfig.json -w",
"release": "tsc --noEmit && yarn build"
"package": "tsc --noEmit && yarn build",
"prepublish": "yarn package"
},
"keywords": [
"yuque",
Expand Down
3 changes: 2 additions & 1 deletion src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export async function main() {
const repoName = github.context.repo.repo
const remoteOrigin = `https://${username}:${token}@github.com/${username}/${repoName}.git`
const outFilePath =
docsDir + (/\.mdx?$/.test(outFile) ? outFile : `${outFile}.md`)
(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)
Expand Down

0 comments on commit 3438d60

Please sign in to comment.