aboutsummaryrefslogtreecommitdiff
path: root/.github/actions/sshfs/action.yml
blob: 5f94f95e052ac3b4e14673752c94be3e92078a86 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: SSHFS

description: |
  Mount data areas using SSHFS

inputs:
  user:
    type: string
    required: true
    default: ""

  password:
    type: string
    required: true
    default: ""

  remote_host:
    type: string
    required: true
    default: ""

  remote_dir:
    type: string
    required: true
    default: ""

  local_dir:
    type: string
    required: false
    default: ""

runs:
  using: "composite"
  steps:
    - name: Install SSHFS
      run: |
        sudo apt update
        sudo apt -y install sshfs
      shell: bash

    - name: Mount ${{ inputs.remote_dir }} at ${{ inputs.local_path }}
      run: |
        local_dir="${{ inputs.local_dir }}"
        if [[ -z "$local_dir" ]]; then
            local_dir="${{ inputs.remote_dir }}"
        fi

        sudo mkdir -p "$local_dir"
        sudo sshfs \
            -o StrictHostKeyChecking=no,password_stdin,allow_other,default_permissions \
            ${{ inputs.user }}@${{ inputs.remote_host}}:${{ inputs.remote_dir }} \
            "$local_dir" \
            <<< "${{ inputs.password }}"
      shell: bash