Skip to content

Commit

Permalink
fix: 优化 actions 34
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Mar 17, 2023
1 parent c10eb06 commit 23b1367
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/actions/npm-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ runs:
result-encoding: string
script: |
const pkg = require('./package.json');
const safeName = pkg.name.replace(/@(.*)\/(.*)/, '$1__$2');
pkg.name = github.repository_owner + '/' + steps.naming.outputs.replaced;
// originName -> underlineName
// my-pkg -> my-pkg
// @my-scope/my-pkg -> my-scope__my-pkg
const underlineName = pkg.name.replace(/@(.*)\/(.*)/, '$1__$2');
pkg.name = github.repository_owner + '/' + underlineName;
const fs = require('fs');
fs.writeFileSync('package.json', JSON.stringify(pkg));
Expand Down

0 comments on commit 23b1367

Please sign in to comment.