File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ name: NPM Trusted Publisher
22
33on :
44 workflow_call :
5+ secrets :
6+ GIT_TOKEN :
7+ description : ' github personal token'
8+ required : true
59
610 inputs :
711 checkTest :
5559 uses : actions/checkout@v4
5660 with :
5761 path : main_repo
58- token : ${{ secrets.GITHUB_TOKEN }}
62+ token : ${{ secrets.GIT_TOKEN }}
5963
6064 # Setup Node.js environment
6165 - name : Setup Node.js
Original file line number Diff line number Diff line change @@ -145,6 +145,14 @@ BREAKING CHANGE: Drop Node.js < 18 support
145145
146146### 配置方式
147147
148+ - 创建 GitHub Token
149+ - 因为生成的 CHANGELOG.md 和 package.json 需回写 GitHub,而默认的 ` GITHUB_TOKEN ` 没有该权限。如会被保护分支规则拦截。
150+ - 因此需要创建一个新的 Token,参见[ 文档] ( https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token )
151+
152+ - 配置 Token
153+ - 在项目或组织维度配置 ` GIT_TOKEN `
154+ - 参见[ 文档] ( https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-encrypted-secrets-for-your-repository-and-organization-for-github-codespaces )
155+
148156- 创建 ` .github/workflows/release.yml ` :
149157
150158``` yaml
@@ -160,6 +168,8 @@ jobs:
160168 release :
161169 name : Node.js
162170 uses : node-modules/github-actions/.github/workflows/npm-release.yml@master
171+ secrets :
172+ GIT_TOKEN : ${{ secrets.GIT_TOKEN }}
163173 # with:
164174 # checkTest: false
165175 # dryRun: true
You can’t perform that action at this time.
0 commit comments