Skip to content

Commit 1e14c15

Browse files
authored
Merge pull request #1 from RedisLabsModules/dagan.sandler-v1_implementation-dev
Initial action implementation
2 parents 7db1782 + 76808dc commit 1e14c15

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
## About
44

5-
A reusable GitHub Action that executes a bash script inside a container with the current working directory (CWD) mounted. This action simplifies workflows by enabling script execution in an isolated containerized environment while maintaining access to the local project files
5+
A reusable GitHub Action that executes a bash script inside a container with the current working directory (CWD) mounted.
6+
This action simplifies workflows by enabling script execution in an isolated containerized environment while maintaining access to the local project files
67

7-
This allows running [`actions/checkout`](https://github.com/actions/checkout), [`actions/download-artifact`](https://github.com/actions/download-artifact), [`actions/upload-artifact`](https://github.com/actions/upload-artifact), and other actions outside of the container's context.
8+
This action provides an alternative for using the `container:` directive, which runs an entire job inside a container.
9+
10+
This allows running [`actions/checkout`](https://github.com/actions/checkout), [`actions/download-artifact`](https://github.com/actions/download-artifact), [`actions/upload-artifact`](https://github.com/actions/upload-artifact), and other actions outside of the container's context,
11+
avoid conflicts with the container's environment, and allows for a more flexible and modular workflow.
812

913
___
1014

action.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Run Containerized Script
2+
description: |
3+
This action provides a way to run commands on a custom image,
4+
while letting Github handle the setup and teardown of the container, as well as any environment variables and mounts.
5+
Useful when you need to run something on a custom image, but do not wish to run the entire workflow with the `container:` directive.
6+
7+
inputs:
8+
image:
9+
description: "The docker image to use. If the image is stored in a private registry, you may need to authenticate before using this action."
10+
required: true
11+
args:
12+
description: "The arguments to pass to the container. Will be passed to the container using `/bin/bash -c`"
13+
required: true
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Prepare image
19+
run: |
20+
echo "::group::Pulling image ${{ inputs.image }} and retagging as 'containerized_runner'"
21+
docker pull ${{ inputs.image }}
22+
docker tag ${{ inputs.image }} containerized_runner
23+
echo "::endgroup::"
24+
shell: bash
25+
- name: Run on container
26+
uses: ./run
27+
with:
28+
args: ${{ inputs.args }}

run/action.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Run on container
2+
description: "This action should only be triggered by the wrapping run-containerized-script action."
3+
inputs:
4+
args:
5+
description: "The arguments to pass to the container"
6+
required: true
7+
8+
runs:
9+
using: docker
10+
image: containerized_runner
11+
args:
12+
- /bin/bash
13+
- -c
14+
- |
15+
${{ inputs.args }}

0 commit comments

Comments
 (0)