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 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 '
Original file line number Diff line number Diff line change @@ -2,19 +2,17 @@ import * as process from 'process'
22import { expect , test } from '@jest/globals'
33import * as utils from '../src/utils'
44
5-
65test ( 'test runs' , ( ) => {
76 process . env [ 'DATABRICKS_HOST' ] = 'https://xyz.cloud.databricks.com'
87 process . env [ 'DATABRICKS_REPO_ID' ] = '3704530822795627'
9- } )
8+ } )
109
1110test ( 'databricks host' , ( ) => {
1211 const host = utils . get_databricks_host ( )
13- expect ( typeof host ) . toBe ( " string" )
12+ expect ( typeof host ) . toBe ( ' string' )
1413} )
1514
16-
1715test ( '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+ } )
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -2,16 +2,14 @@ import * as core from '@actions/core'
22
33export 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
You can’t perform that action at this time.
0 commit comments