I'm trying to change the GitHub actions variable value which is created through the Github UI in settings -> secrets & variables -> variables
when my pipeline finishes.
Note that I want to change the persisted value, not a value or env variable inside the workflow.
Is this possible?
Thanks
Yes, it can be updated. You can use curl with relevant values in your GitHub action workflow.
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/variables/NAME \
-d '{"name":"USERNAME","value":"octocat"}'
Refer to official doc - https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28#update-a-repository-variable