How to update a secret from GitHUb Actions environment

I have defined some environment into my GitHub repo and defined secrets into environment
In my GitHub Actions workflow in a job I set the environment and get access to the secret of this environment : fine
I need to update the environment secret from job code
I found some GitHub Actions in Marketplace for updating secrets in repo and org but not working for environment secrets
I know also REST API enables that (Actions - GitHub Docs)
Did anybody already need to do that and have some piece of code or corresponding Actions available in Marketplace to share ?

Hi there;
There are some GitHub actions for this purpose and you can easily set-update your secrets.

That action doesn’t support environment secrets, only standard repo and org secrets.
The relevant endpoint is PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}

1 Like

Thank you for your message.

Okay. So why you are not put your new secret data to .env file or push new value by the export command to the OS? (I am not sure what OS you used in your actions)
Do you have another view?

By the way, I think he can easily install curl at your actions and call the webservice by just a single line curl command. not easy?

I managed to get it working with an own updated version of the github-script action, see TypeError: github.repos.createOrUpdateEnvironment is not a function - Octokit.js Support up-to-date? · Issue #133 · actions/github-script · GitHub