Here is a version that should work whatever the serialized contents are (whether they contain quotes, shell special characters or whatever):
- name: Dump GitHub context run: | cat << 'EOF' ${{ toJSON(github) }} EOF