Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What am I missing when trying to update GitHub secrets through my .NET application?

I am trying to store SASToken as GitHub secret. When trying to update the secrets it is not getting updated, its always null. I'm following all steps to encrypt the value before updating in secrets, like mentioned in this link https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28. I'm using "Create or update an environment secret https://api.github.com/repositories/REPOSITORY_ID/environments/ENVIRONMENT_NAME/secrets/SECRET_NAME".Not sure what I am missing.

Used the steps in the link to create the environment secret https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28. But the value is not updating.

like image 748
user21991714 Avatar asked Oct 15 '25 02:10

user21991714


1 Answers

I posted an answer on another SO post but my guess is that you are using the public key for the repository, not the environment.

Try using the Get an Environment Public Key endpoint and saving your secret again. This appears to have worked for me, though I'm going to do more testing to double check.

like image 71
joshft91 Avatar answered Oct 18 '25 07:10

joshft91