From 6fd371aeafa000194cfbc9d8f36235844a20d492 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 28 Sep 2019 12:26:40 +0800 Subject: [PATCH] docs: add example --- .github/workflows/ci.yml | 11 +++++++++++ README.md | 33 +++++++++++++++++++++++++++++++++ action.yml | 2 ++ 3 files changed, 46 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad8ce0c..5d5fcd0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,3 +26,14 @@ jobs: port: ${{ secrets.PORT }} source: "tests/a.txt,tests/b.txt" target: "test" + + - name: remove the specified number of leading path elements + uses: appleboy/scp-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "foobar" + strip_components: 1 diff --git a/README.md b/README.md index 95ba00d..8f71ef8 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ see the [action.yml](./action.yml) file for more detail imformation. * target - target path on the server * source - scp file list * rm - remove target folder before upload data +* strip_components - remove the specified number of leading path elements. ### Example @@ -98,3 +99,35 @@ Example configuration for multiple server source: "tests/a.txt,tests/b.txt" target: "test" ``` + +remove the specified number of leading path elements + +```yaml +- name: remove the specified number of leading path elements + uses: appleboy/scp-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "foobar" + strip_components: 1 +``` + +old target structure: + +```sh +foobar + └── tests + ├── a.txt + └── b.txt +``` + +new target structure: + +```sh +foobar + ├── a.txt + └── b.txt +``` diff --git a/action.yml b/action.yml index 03c35b0..ca3d823 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,8 @@ inputs: description: 'scp file list' rm: description: 'remove target folder before upload data' + strip_components: + description: 'remove the specified number of leading path elements' runs: using: 'docker' image: 'Dockerfile'