appleboy / scp-action

GitHub Action that copy files and artifacts via SSH.
https://github.com/marketplace/actions/scp-command-to-transfer-files
MIT License
1.14k stars 134 forks source link

Question about Remove the Specified Number of Leading Path Elements #111

Open paigeman opened 1 year ago

paigeman commented 1 year ago

as described in README.md:

- name: remove the specified number of leading path elements
  uses: appleboy/scp-action@v0.1.4
  with:
    host: ${{ secrets.HOST }}
    username: ${{ secrets.USERNAME }}
    key: ${{ secrets.KEY }}
    port: ${{ secrets.PORT }}
    source: "tests/a.txt,tests/b.txt"
    target: your_server_target_folder_path
    strip_components: 1

code above can remove the specified number of leading path element. However, it seems there is no solution when sources come from different directories. For example:

- name: remove the specified number of leading path elements
  uses: appleboy/scp-action@v0.1.4
  with:
    host: ${{ secrets.HOST }}
    username: ${{ secrets.USERNAME }}
    key: ${{ secrets.KEY }}
    port: ${{ secrets.PORT }}
    source: "tests/a.txt,testa/bbd/b.txt"
    target: your_server_target_folder_path
    strip_components: 1

I think it might be easy to support by passing numbers splitted by comma in strip_components option.