Skip to content

Conversation

@k0ff33
Copy link
Contributor

@k0ff33 k0ff33 commented Dec 12, 2025

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

@goruha goruha changed the base branch from main to k0ff33-main December 23, 2025 23:13
@goruha goruha merged commit 25beafa into cloudposse:k0ff33-main Dec 23, 2025
5 of 9 checks passed
goruha added a commit that referenced this pull request Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants