Skip to content

v2.3.0

Latest

Choose a tag to compare

@cloudposse-releaser cloudposse-releaser released this 24 Dec 11:09
1d99c39
Fix handling metadata with single quotes (#90) @goruha (#91) ## what * Change the way how docker build output metadata is processed to handle escape character

why

  • Metadata JSON from docker-build-push-action contains head/merge commit details including message which might include single quotes
  • get-metadata step wraps the JSON in single quotes causing the build step to break if merge commit contains a single quote character (e.g. as part of commit description):
Run metadata=$(echo '{
...
/home/runner/work/_temp/b76bb997-9a9b-4a18-ac9f-321762ea58ba.sh: line 79: syntax error near unexpected token `('
Error: Process completed with exit code 2.
# OR
/home/runner/_work/_temp/5912f8a7-4a6e-4f73-a4c5-b6730c3ebf58.sh: line 456: unexpected EOF while looking for matching `"'
Error: Process completed with exit code 2.
  • Simple way to reproduce the error locally:
metadata=$(echo '{ "message": "that's fine" }' | jq -c)
  • The native bash way to escape single quotes would be to replace ' with '', however, GHA provide toJSON method which automatically escape characters when used in ENV (reference below)

references