File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ import { execSync } from 'child_process'
23
23
// can be restored afterwards and used by releasePublish. We can't use the same
24
24
// token, because releasePublish wants a token that has the id_token: write permission
25
25
// so that we can use OIDC for trusted publishing
26
-
26
+ const gh_token_bak = process . env . GITHUB_TOKEN
27
+ process . env . GITHUB_TOKEN = process . env . RELEASE_GITHUB_TOKEN
27
28
// backup original auth header
28
29
const originalAuth = execSync ( 'git config --local http.https://github.com/.extraheader' )
29
30
. toString ( )
@@ -42,6 +43,9 @@ import { execSync } from 'child_process'
42
43
// npm publish with OIDC
43
44
// not strictly necessary to restore the header but do it incase we require it later
44
45
execSync ( `git config --local http.https://github.com/.extraheader "${ originalAuth } "` )
46
+ // restore the GH token
47
+ process . env . GITHUB_TOKEN = gh_token_bak
48
+
45
49
const publishResult = await releasePublish ( {
46
50
registry : 'https://registry.npmjs.org/' ,
47
51
access : 'public' ,
Original file line number Diff line number Diff line change @@ -61,7 +61,8 @@ if (!validSpecifiers.includes(versionSpecifier) && !isValidVersion) {
61
61
// can be restored afterwards and used by releasePublish. We can't use the same
62
62
// token, because releasePublish wants a token that has the id_token: write permission
63
63
// so that we can use OIDC for trusted publishing
64
-
64
+ const gh_token_bak = process . env . GITHUB_TOKEN
65
+ process . env . GITHUB_TOKEN = process . env . RELEASE_GITHUB_TOKEN
65
66
// backup original auth header
66
67
const originalAuth = execSync ( 'git config --local http.https://github.com/.extraheader' )
67
68
. toString ( )
@@ -81,6 +82,8 @@ if (!validSpecifiers.includes(versionSpecifier) && !isValidVersion) {
81
82
// npm publish with OIDC
82
83
// not strictly necessary to restore the header but do it incase we require it later
83
84
execSync ( `git config --local http.https://github.com/.extraheader "${ originalAuth } "` )
85
+ // restore the GH token
86
+ process . env . GITHUB_TOKEN = gh_token_bak
84
87
85
88
const publishResult = await releasePublish ( {
86
89
registry : 'https://registry.npmjs.org/' ,
You can’t perform that action at this time.
0 commit comments