Is there any way Docker can know about the source / tags that Docker Hub Autobuilds uses !?

We use Docker Hub Autobuilds to generate images, which works great, but we REALLY want to have a file or something similar in the container that contains the source version ( i.e. tag ) that the image was built from. ( Think of it as physical evidence that the image was built from the correct source ! )
Currently we manually edit a version.txt file in the code BEFORE we create a release/tag in github or bitbucket, but this is a pain and we’d like to automate it.
I can’t think of any way to get the tag and/or release information into the image itself, if anyone has a clever idea then please let me know !