Access files of a github runner?

Hello,

one job of my github actions checked out out my repository and created locally a new commit hash. I need to retrieve that commit hash for legal reasons. Is it possible to somehow access all the files of the gitlab runner executed that job? Or download the git metadata of this job somehow?

In principle: You can upload the files you need as artifacts, see Storing workflow data as artifacts - GitHub Docs.

Another question is whether that actually makes sense. I don’t know the legal requirements you’re dealing with, but if you need the commit ID for archival you probably need the actual commit data, too. In that case it might make sense to push the result back to your repository (possibly on a dedicated branch) or to some other repository you use for archiving.