Skip to content

Commit 04c17c5

Browse files
build: Package action as dist with latest changes
1 parent f977801 commit 04c17c5

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ context and support.
2121
| `image` | Docker Image to extract files from | ✅ | `alpine` `ghcr.io/github/super-linter:latest` |
2222
| `path` | Path (from root) to a file or directory within Image | ✅ | `files/example.txt` `files` `files/.` |
2323
| `destination` | Destination path for the extracted files | ❌ | `/foo/` `~/` `./foo/bar` |
24+
| `shell` | The shell to use for extraction | ❌ | `/bin/bash` `/bin/sh` |
2425

2526
> :paperclip: To copy the **contents** of a directory the `path` must end with
2627
> `/.` otherwise the directory itself will be copied. More information about the

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
destination:
1212
description: 'Destination path for the extracted files'
1313
required: false
14+
shell:
15+
description: 'The shell to use for extraction (default: /bin/bash)'
16+
required: false
17+
default: '/bin/bash'
1418
outputs:
1519
destination:
1620
description: 'Destination of extracted file(s)'

dist/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,7 @@ async function run() {
10921092
const image = core.getInput('image');
10931093
const path = core.getInput('path');
10941094
const destination = core.getInput('destination') || `extracted-${Date.now()}`;
1095+
const shell = core.getInput('shell');
10951096

10961097
if (!core.getInput('destination')) {
10971098
core.notice([
@@ -1106,13 +1107,13 @@ async function run() {
11061107
const create = `docker cp $(docker create ${image}):/${path} ${destination}`;
11071108

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

11111112
core.setOutput('destination', destination);
11121113
} catch (error) {
11131114
core.setFailed(error.message);
11141115
}
1115-
}
1116+
};
11161117

11171118
run();
11181119

src/extract.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ async function run() {
66
const image = core.getInput('image');
77
const path = core.getInput('path');
88
const destination = core.getInput('destination') || `extracted-${Date.now()}`;
9+
const shell = core.getInput('shell');
910

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

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

2526
core.setOutput('destination', destination);
2627
} catch (error) {
2728
core.setFailed(error.message);
2829
}
29-
}
30+
};
3031

3132
run();

0 commit comments

Comments
 (0)