Skip to content

Commit

Permalink
build: Package action as dist with latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 18, 2023
1 parent 22c00ba commit e3f94b3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ A GitHub Action for extracting files from a Docker Image.
## Inputs
All inputs are required.
| ID | Description | Examples |
| ------- | ---------------------------------------------------- | --------------------------------------------- |
| `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/.` |
| ID | Description | Required | Examples |
| ------------- | ---------------------------------------------------- | :------: | --------------------------------------------- |
| `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` |

> :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
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
path:
description: 'Path (from root) to a file or directory within Image'
required: true
destination:
description: 'Destination path for the extracted files'
required: false
outputs:
destination:
description: 'Destination of extracted file(s)'
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,8 @@ async function run() {
try {
const image = core.getInput('image');
const path = core.getInput('path');
const destination = `.extracted-${Date.now()}`;
const destination = core.getInput('destination') || `.extracted-${Date.now()}`;

const create = `docker cp $(docker create ${image}):/${path} ${destination}`;

await exec.exec(`mkdir -p ${destination}`);
Expand Down
3 changes: 2 additions & 1 deletion src/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ async function run() {
try {
const image = core.getInput('image');
const path = core.getInput('path');
const destination = `.extracted-${Date.now()}`;
const destination = core.getInput('destination') || `.extracted-${Date.now()}`;

const create = `docker cp $(docker create ${image}):/${path} ${destination}`;

await exec.exec(`mkdir -p ${destination}`);
Expand Down

0 comments on commit e3f94b3

Please sign in to comment.