Skip to content

Commit 7c7d4ef

Browse files
authored
Merge pull request #87 from antstackio/dev
New changes
2 parents 4ca4d73 + 80303a7 commit 7c7d4ef

File tree

6 files changed

+29
-24
lines changed

6 files changed

+29
-24
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
databricks-repo-branch: 'main'
2525
databricks-token: ${{ secrets.DATABRICKS_TOKEN }}
2626
databricks-host: 'https://dbc-89c9e463-7ff5.cloud.databricks.com'
27-
databricks-repo-id: '3704530822795613'
27+
databricks-repo-id: '2811515952360794'

__tests__/main.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@ import * as process from 'process'
22
import {expect, test} from '@jest/globals'
33
import * as utils from '../src/utils'
44

5-
65
test('test runs', () => {
76
process.env['DATABRICKS_HOST'] = 'https://xyz.cloud.databricks.com'
87
process.env['DATABRICKS_REPO_ID'] = '3704530822795627'
9-
})
8+
})
109

1110
test('databricks host', () => {
1211
const host = utils.get_databricks_host()
13-
expect(typeof host).toBe("string")
12+
expect(typeof host).toBe('string')
1413
})
1514

16-
1715
test('databricks repo id', () => {
1816
const host = utils.get_databricks_repo_id()
19-
expect(typeof host).toBe("string")
20-
})
17+
expect(typeof host).toBe('string')
18+
})

dist/index.js

Lines changed: 11 additions & 8 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: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,21 @@ async function run(): Promise<void> {
2525
)
2626

2727
const status = response.status
28+
core.info(`status code ${status}`)
2829
if (status === 200) {
2930
core.info('Deployed the code successfully')
31+
} else if (status === 401) {
32+
core.info(
33+
'Authentication error, please check your databricks token!'
34+
)
3035
} else {
3136
core.setFailed('Failed to update the repo')
3237
}
3338
} catch (error) {
34-
if (error instanceof Error) core.setFailed(error.message)
39+
if (error instanceof Error) {
40+
core.info(error.message)
41+
core.setFailed(error.message)
42+
}
3543
}
3644
}
3745

src/utils.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ import * as core from '@actions/core'
22

33
export function get_databricks_host(): string {
44
const databricks_host_input: string = core.getInput('databricks-host')
5-
const databricks_host_env: string = process.env['DATABRICKS_HOST'] || ''
5+
const databricks_host_env: string = process.env['DATABRICKS_HOST'] ?? ''
66

77
if (!databricks_host_input && !databricks_host_env) {
88
throw new Error(
99
'databricks-host or DATABRICKS_HOST environment variable must be set.'
1010
)
1111
} else {
12-
return databricks_host_input
13-
? databricks_host_input
14-
: databricks_host_env
12+
return databricks_host_input || databricks_host_env
1513
}
1614
}
1715

@@ -23,9 +21,7 @@ export function get_databricks_repo_id(): string {
2321
'databricks-repo-id or DATABRICKS_REPO_ID environment variable must be set.'
2422
)
2523
} else {
26-
return databricks_repo_input
27-
? databricks_repo_input
28-
: databricks_repo_env
24+
return databricks_repo_input || databricks_repo_env
2925
}
3026
}
3127

0 commit comments

Comments
 (0)