File tree Expand file tree Collapse file tree 6 files changed +29
-24
lines changed Expand file tree Collapse file tree 6 files changed +29
-24
lines changed Original file line number Diff line number Diff line change 24
24
databricks-repo-branch : ' main'
25
25
databricks-token : ${{ secrets.DATABRICKS_TOKEN }}
26
26
databricks-host : ' https://dbc-89c9e463-7ff5.cloud.databricks.com'
27
- databricks-repo-id : ' 3704530822795613 '
27
+ databricks-repo-id : ' 2811515952360794 '
Original file line number Diff line number Diff line change @@ -2,19 +2,17 @@ import * as process from 'process'
2
2
import { expect , test } from '@jest/globals'
3
3
import * as utils from '../src/utils'
4
4
5
-
6
5
test ( 'test runs' , ( ) => {
7
6
process . env [ 'DATABRICKS_HOST' ] = 'https://xyz.cloud.databricks.com'
8
7
process . env [ 'DATABRICKS_REPO_ID' ] = '3704530822795627'
9
- } )
8
+ } )
10
9
11
10
test ( 'databricks host' , ( ) => {
12
11
const host = utils . get_databricks_host ( )
13
- expect ( typeof host ) . toBe ( " string" )
12
+ expect ( typeof host ) . toBe ( ' string' )
14
13
} )
15
14
16
-
17
15
test ( 'databricks repo id' , ( ) => {
18
16
const host = utils . get_databricks_repo_id ( )
19
- expect ( typeof host ) . toBe ( " string" )
20
- } )
17
+ expect ( typeof host ) . toBe ( ' string' )
18
+ } )
Original file line number Diff line number Diff line change @@ -25,13 +25,21 @@ async function run(): Promise<void> {
25
25
)
26
26
27
27
const status = response . status
28
+ core . info ( `status code ${ status } ` )
28
29
if ( status === 200 ) {
29
30
core . info ( 'Deployed the code successfully' )
31
+ } else if ( status === 401 ) {
32
+ core . info (
33
+ 'Authentication error, please check your databricks token!'
34
+ )
30
35
} else {
31
36
core . setFailed ( 'Failed to update the repo' )
32
37
}
33
38
} 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
+ }
35
43
}
36
44
}
37
45
Original file line number Diff line number Diff line change @@ -2,16 +2,14 @@ import * as core from '@actions/core'
2
2
3
3
export function get_databricks_host ( ) : string {
4
4
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' ] ?? ''
6
6
7
7
if ( ! databricks_host_input && ! databricks_host_env ) {
8
8
throw new Error (
9
9
'databricks-host or DATABRICKS_HOST environment variable must be set.'
10
10
)
11
11
} else {
12
- return databricks_host_input
13
- ? databricks_host_input
14
- : databricks_host_env
12
+ return databricks_host_input || databricks_host_env
15
13
}
16
14
}
17
15
@@ -23,9 +21,7 @@ export function get_databricks_repo_id(): string {
23
21
'databricks-repo-id or DATABRICKS_REPO_ID environment variable must be set.'
24
22
)
25
23
} else {
26
- return databricks_repo_input
27
- ? databricks_repo_input
28
- : databricks_repo_env
24
+ return databricks_repo_input || databricks_repo_env
29
25
}
30
26
}
31
27
You can’t perform that action at this time.
0 commit comments