Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ steps:
databricks-token: token
local-path: ./my-local-path
remote-path: /my-remote-path
# clean-workspace-remote-directory: true
```

### Inputs
Expand All @@ -42,6 +43,7 @@ steps:
| `databricks-token` | Databricks token, it can be a PAT or an AAD Token | true |NA|
| `local-path` | Path of the directory you want to import | true |NA|
| `remote-path` | Path of the directory inside Databricks workspace where you want the files to land| true |NA|
| `clean-workspace-remote-directory` | Removes objects recursive from the Databricks workspace specified remote-path before they get added by this action| false | false |

## Contributing

Expand Down
12 changes: 11 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@ inputs:
remote-path:
description: 'REMOTE_NOTEBOOK_PATH'
required: true
clean-workspace-remote-directory:
description: 'Removes objects recursive from the Databricks workspace specified REMOTE_NOTEBOOK_PATH'
required: false
default: false

runs:
using: "composite"
steps:
- id: import-notebooks
run: |
run: |
if [ $CLEAN_WORKSPACE_REMOTE_DIRECTORY = true ]
then
echo "Removes objects recursive from $REMOTE_NOTEBOOK_PATH in the workspace $DATABRICKS_HOST"
databricks workspace rm -r "${REMOTE_NOTEBOOK_PATH}"
fi
echo "Uploading notebooks from $LOCAL_NOTEBOOKS_PATH to $REMOTE_NOTEBOOK_PATH in the workspace $DATABRICKS_HOST"
databricks workspace import_dir --overwrite "${LOCAL_NOTEBOOKS_PATH}" "${REMOTE_NOTEBOOK_PATH}" --debug
shell: bash
Expand All @@ -28,3 +37,4 @@ runs:
DATABRICKS_TOKEN: ${{ inputs.databricks-token}}
LOCAL_NOTEBOOKS_PATH: ${{ inputs.local-path }}
REMOTE_NOTEBOOK_PATH: ${{ inputs.remote-path }}
CLEAN_WORKSPACE_REMOTE_DIRECTORY: ${{ inputs.clean-workspace-remote-directory }}