You're saying there's a github API that takes as an argument a secret, and creates a git commit containing that secret? I'm very surprised. Can you provide a reference to the API call?
https://docs.github.com/en/rest/actions/secrets?apiVersion=2....