Skip to content

Commit 03c98cf

Browse files
authored
avoid print password (#8)
* avoid print password * skip * fmt * fmt
1 parent 59764f3 commit 03c98cf

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

__tests__/main.test.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {wait} from '../src/wait'
22
import {expect, test} from '@jest/globals'
3-
import {sqluser} from "../src/sqluser";
4-
import * as core from "@actions/core";
3+
import {sqluser} from '../src/sqluser'
4+
import * as core from '@actions/core'
55

66
test('throws invalid number', async () => {
77
const input = parseInt('foo', 10)
@@ -17,12 +17,15 @@ test('wait 500 ms', async () => {
1717
})
1818

1919
// replace the externalId, public key and private key with your own
20-
test('sqluser', async () => {
21-
const externalId = "{\"project_id\":\"163469\",\"cluster_id\":\"3478958\",\"branch_id\":\"bran-pbc3jwxonzhcrmbhqxicopyojq\",\"branch_name\":\"hello/syh\"}"
22-
const sqlUser = await sqluser( externalId,
23-
msg => core.info(msg),
24-
"",
25-
"",
26-
"dev")
20+
test.skip('sqluser', async () => {
21+
const externalId =
22+
'{"project_id":"163469","cluster_id":"3478958","branch_id":"bran-pbc3jwxonzhcrmbhqxicopyojq","branch_name":"hello/syh"}'
23+
const sqlUser = await sqluser(
24+
externalId,
25+
msg => core.info(msg),
26+
'',
27+
'',
28+
'dev'
29+
)
2730
console.log(sqlUser)
28-
})
31+
}, 20000)

dist/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async function run(): Promise<void> {
6363
core.setSecret(sqlUser.password)
6464
}
6565
core.info(
66-
`Got sql user. host: ${sqlUser.host}, username: ${sqlUser.username}, password: ${sqlUser.password}`
66+
`Got db user. host: ${sqlUser.host}, username: ${sqlUser.username}, port: ${sqlUser.port}`
6767
)
6868
core.setOutput('host', sqlUser.host)
6969
core.setOutput('username', sqlUser.username)

src/sqluser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export async function sqluser(
5757

5858
// get sql user
5959
const sqlUserUrl = `${host}/api/internal/projects/${projectID}/clusters/${clusterID}/branches/${escapeBranchName}/users`
60-
log(`request url to get sql user: ${sqlUserUrl}`)
60+
log(`request url to get db user: ${sqlUserUrl}`)
6161
const resp = await client.fetch(sqlUserUrl, {method: 'POST'})
6262
const data = await resp.json()
6363
if (data['username'] === undefined || data['password'] === undefined) {

0 commit comments

Comments
 (0)