I recently had to copy a secret which was available in a CI-job to a new repository, but the system was smart enough to filter it if echoed literally.
So "echo $API_TOKEN" failed, but getting the output of the complete environment was as easy as "env | base64".