Skip to content

Commit 4eb189c

Browse files
authoredDec 16, 2021
fix: default silence tokens (#34)
1 parent 67834d9 commit 4eb189c

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed
 

‎.changeset/lucky-spies-fold.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'changesets-gitlab': patch
3+
---
4+
5+
slience @action/exec to execute settting GitLab credentials

‎README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ GLOBAL_AGENT_NO_PROXY # Like above but for no proxied requests
4949

5050
GITLAB_HOST # optional, if you're using custom GitLab host
5151

52-
GITLAB_TOKEN # required, token with accessibility to push
53-
GITLAB_TOKEN_TYPE # optional, type of the provided token in GITLAB_TOKEN. defaults to personal access token. can be `job` if you provide the Gitlab CI_JOB_TOKEN or `oauth` if you use Gitlab Oauth token
54-
GITLAB_CI_USER_NAME # required, username with accessibility to push, used in pairs of the above token (if it was personal access token)
55-
GITLAB_CI_USER_EMAIL # optional, default `gitlab[bot]@users.noreply.gitlab.com`
52+
GITLAB_TOKEN # required, token with accessibility to push
53+
GITLAB_TOKEN_TYPE # optional, type of the provided token in GITLAB_TOKEN. defaults to personal access token. can be `job` if you provide the Gitlab CI_JOB_TOKEN or `oauth` if you use Gitlab Oauth token
54+
GITLAB_CI_USER_NAME # required, username with accessibility to push, used in pairs of the above token (if it was personal access token)
55+
GITLAB_CI_USER_EMAIL # optional, default `gitlab[bot]@users.noreply.gitlab.com`
56+
DEBUG_GITLAB_CREDENTIAL # optional, default `false`
5657
```
5758

5859
### Example workflow

‎src/main.ts

+13-8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const main = async ({
2222
GITLAB_TOKEN,
2323
HOME,
2424
NPM_TOKEN,
25+
DEBUG_GITLAB_CREDENTIAL = 'false',
2526
} = process.env
2627

2728
setOutput('published', false)
@@ -35,14 +36,18 @@ export const main = async ({
3536

3637
const url = new URL(GITLAB_HOST)
3738

38-
await exec('git', [
39-
'remote',
40-
'set-url',
41-
'origin',
42-
`${url.protocol}//${GITLAB_CI_USER_NAME!}:${GITLAB_TOKEN!}@${
43-
url.host
44-
}/${CI_PROJECT_PATH!}.git`,
45-
])
39+
await exec(
40+
'git',
41+
[
42+
'remote',
43+
'set-url',
44+
'origin',
45+
`${url.protocol}//${GITLAB_CI_USER_NAME!}:${GITLAB_TOKEN!}@${
46+
url.host
47+
}/${CI_PROJECT_PATH!}.git`,
48+
],
49+
{ silent: !['true', '1'].includes(DEBUG_GITLAB_CREDENTIAL) },
50+
)
4651
}
4752

4853
const { changesets } = await readChangesetState()

0 commit comments

Comments
 (0)