Skip to content
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ context and support.
| `image` | Docker Image to extract files from | ✅ | `alpine` `ghcr.io/github/super-linter:latest` |
| `path` | Path (from root) to a file or directory within Image | ✅ | `files/example.txt` `files` `files/.` |
| `destination` | Destination path for the extracted files | ❌ | `/foo/` `~/` `./foo/bar` |
| `shell` | The shell to use for extraction | ❌ | `/bin/bash` `/bin/sh` |

> :paperclip: To copy the **contents** of a directory the `path` must end with
> `/.` otherwise the directory itself will be copied. More information about the
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
destination:
description: 'Destination path for the extracted files'
required: false
shell:
description: 'The shell to use for extraction (default: /bin/bash)'
required: false
default: '/bin/bash'
outputs:
destination:
description: 'Destination of extracted file(s)'
Expand Down
5 changes: 3 additions & 2 deletions src/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ async function run() {
const image = core.getInput('image');
const path = core.getInput('path');
const destination = core.getInput('destination') || `extracted-${Date.now()}`;
const shell = core.getInput('shell');

if (!core.getInput('destination')) {
core.notice([
Expand All @@ -20,12 +21,12 @@ async function run() {
const create = `docker cp $(docker create ${image}):/${path} ${destination}`;

await exec.exec(`mkdir -p ${destination}`);
await exec.exec(`/bin/bash -c "${create}"`, []);
await exec.exec(`${shell} -c "${create}"`, []);

core.setOutput('destination', destination);
} catch (error) {
core.setFailed(error.message);
}
}
};

run();
Loading