Skip to content

Commit

Permalink
Merge pull request #6 from livecycle/eliyabar-change-preevy-up-input
Browse files Browse the repository at this point in the history
parse arrays
  • Loading branch information
eliyabar authored Jul 18, 2023
2 parents a8d68ec + bfe216c commit 5fe540c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
id: preevy
with:
profile-url: "s3://preevy-12345678-my-profile?region=eu-west-1"
docker-compose-yaml-paths: [./docker/docker-compose.yaml]
docker-compose-yaml-paths: "./docker/docker-compose.yaml"
- uses: mshick/add-pr-comment@v2
with:
message: ${{ steps.preevy.outputs.urls-markdown }}
Expand Down
21 changes: 16 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,26 @@ runs:
shell: bash
id: run_preevy
run: |
# Convert the docker-compose-yaml-path input to an env var
compose_file_path=${{ join(inputs.docker-compose-yaml-paths, '-f ') }}
compose_file_path_or_default=${compose_file_path:+-f ${compose_file_path}}
# Convert the docker-compose-yaml-paths input to an env var
paths=${{ inputs.docker-compose-yaml-paths }}
# Initialize the joined preevy paths string
joined_paths=""
# Loop through the array and build the joined_paths string
for path in "${paths[@]}"; do
if [[ -n $path ]]; then
# Add -f and path to the joined_paths string
joined_paths+="-f $path "
fi
done
# Run the up command
preevy up ${compose_file_path_or_default} ${{ inputs.args }}
preevy up ${joined_paths} ${{ inputs.args }}
# Fetch the generated preevy urls
urls_json="$(preevy urls ${compose_file_path_or_default} --json)"
urls_json="$(preevy urls ${joined_paths} --json)"
# Format urls into a markdown table and store them in urls.txt
cat << EOF > urls.txt
Expand Down

0 comments on commit 5fe540c

Please sign in to comment.