Skip to content

Commit

Permalink
fix: arguments interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed Jan 31, 2024
1 parent fb272f1 commit ea2bf8a
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,24 @@ runs:
shell: bash
working-directory: ${{ inputs.working-directory }}
run: |
function print_assignment {
local output_name="$1"
local value="$2"
echo "$output_name=$(
cat <<EOM | tr '\n' ' '
$value
EOM
)"
}
{
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' ' ')"
print_assignment "stack-query-arguments" "${{ inputs.query-arguments }}"
print_assignment "stack-path-arguments" "${{ inputs.path-arguments }}"
print_assignment "stack-setup-arguments" "${{ inputs.setup-arguments }}"
print_assignment "stack-build-arguments-dependencies" "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-dependencies }}"
print_assignment "stack-build-arguments-build" "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-build }}"
print_assignment "stack-build-arguments-test" "${{ inputs.stack-build-arguments }} ${{ inputs.stack-build-arguments-test }}"
} >> "$GITHUB_OUTPUT"
has_resolver() {
Expand All @@ -155,7 +166,7 @@ runs:
echo "resolver-nightly=$resolver_nightly" >>"$GITHUB_OUTPUT"
echo "stack-arguments=--stack-yaml ${{ inputs.stack-yaml }} $resolver_nightly $(echo "${{ inputs.stack-arguments }}" | tr '\n' ' ')" >>"$GITHUB_OUTPUT"
print_assignment "stack-arguments" "--stack-yaml ${{ inputs.stack-yaml }} $resolver_nightly ${{ inputs.stack-arguments }}" >>"$GITHUB_OUTPUT"
echo 'stack-works<<EOM' >>"$GITHUB_OUTPUT"
# We can't just list out '**/.stack-work' because the files may not
Expand All @@ -177,7 +188,7 @@ runs:
# Always include a top-level .stack-work, with the location being driven
# by the stack-yaml directory.
echo "$(dirname '${{ format('{0}/{1}', inputs.working-directory, inputs.stack-yaml) }}')/.stack-work" >>"$GITHUB_OUTPUT"
echo "$(dirname '${{ inputs.working-directory }}/${{ inputs.stack-yaml }}')/.stack-work" >>"$GITHUB_OUTPUT"
echo 'EOM' >>"$GITHUB_OUTPUT"
# NB. hashFiles() is VERY PICKY. We need to account for
Expand Down

0 comments on commit ea2bf8a

Please sign in to comment.