Skip to content

Commit

Permalink
feat: handle multiline inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed Jan 22, 2024
1 parent 02124ca commit 3f07bb7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ runs:
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
echo "stack-build-arguments-build= ${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-build }}" >>"$GITHUB_OUTPUT"
echo "stack-build-arguments-dependencies=${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-dependencies }}" >>"$GITHUB_OUTPUT"
echo "stack-build-arguments-test= ${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-test }}" >>"$GITHUB_OUTPUT"
{
echo "stack-query-arguments= $(echo "${{ inputs.query-arguments }} " | tr '\n' ' ')"
echo "stack-path-arguments= $(echo "${{ inputs.path-arguments }} " | tr '\n' ' ')"
echo "stack-setup-arguments= $(echo "${{ inputs.setup-arguments }} " | tr '\n' ' ')"
echo "stack-build-arguments-dependencies= $(echo "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-dependencies }}" | tr '\n' ' ')"
echo "stack-build-arguments-build= $(echo "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-build }}" | tr '\n' ' ')"
echo "stack-build-arguments-test= $(echo "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-test }}" | tr '\n' ' ')"
} >> "$GITHUB_OUTPUT"
has_resolver() {
grep -Fq -- '--resolver' <<'EOM'
Expand All @@ -147,7 +152,7 @@ runs:
echo "resolver-nightly=$resolver_nightly" >>"$GITHUB_OUTPUT"
echo "stack-arguments=--no-terminal --stack-yaml ${{ inputs.stack-yaml }} $resolver_nightly ${{ inputs.stack-arguments }}" >>"$GITHUB_OUTPUT"
echo "stack-arguments=--no-terminal --stack-yaml ${{ inputs.stack-yaml }} $resolver_nightly $(echo "${{ inputs.stack-arguments }}" | tr '\n' ' ')" >>"$GITHUB_OUTPUT"
echo 'stack-works<<EOM' >>"$GITHUB_OUTPUT"
# We can't just list out '**/.stack-work' because the files may not
Expand Down Expand Up @@ -189,7 +194,7 @@ runs:
trap 'rm -r "$tmp"' EXIT
stack ${{ steps.setup.outputs.stack-arguments }} \
query compiler ${{ inputs.stack-query-arguments }} \
query compiler ${{ steps.setup.outputs.stack-query-arguments }} \
| tee "$tmp"
sed '/^actual: \(.*\)$/!d; s//compiler=\1/' "$tmp" >>"$GITHUB_OUTPUT"
Expand All @@ -201,7 +206,7 @@ runs:
shell: bash
run: |
stack ${{ steps.setup.outputs.stack-arguments }} \
path ${{ inputs.stack-path-arguments }} \
path ${{ steps.setup.outputs.stack-path-arguments }} \
| while IFS=:\ read -r name value; do
printf '%s: %s\n' "$name" "$value"
printf '%s=%s\n' "$name" "$value" >>"$GITHUB_OUTPUT"
Expand All @@ -226,7 +231,7 @@ runs:
working-directory: ${{ inputs.working-directory }}
run: |
stack ${{ steps.setup.outputs.stack-arguments }} \
setup ${{ inputs.stack-setup-arguments }}
setup ${{ steps.setup.outputs.stack-setup-arguments }}
stack ${{ steps.setup.outputs.stack-arguments }} \
build --dependencies-only --test --no-run-tests \
${{ steps.setup.outputs.stack-build-arguments-dependencies }}
Expand Down

0 comments on commit 3f07bb7

Please sign in to comment.