Upsert a Repository Variable
A 4-step recipe with GitHub Actions. We can help you get access.
Recipe · 4 steps
Upsert a Repository Variable
with GitHub Actions · Configuration & Secrets Management
Works with AI assistants
Create or update a repository variable by name and confirm its value.
- Read the variable by name. A 200 means it exists and should be updated; a 404 means it does not exist and should be created.
- Patch the existing variable with the new value. Returns 204 with no body.
- Create the variable with the supplied name and value. Returns 201.
- Read the variable back to confirm the stored value after the upsert.
What you'll need to have ready
- accessToken: GitHub bearer token with Actions variables write access.
- owner: The account owner of the repository.
- repo: The name of the repository without the .git extension.
- variableName: The name of the variable to create or update.
- variableValue: The value to store on the variable.
For your developer
Arazzo workflow github-actions:upsert-repo-variable, 4 operations: getRepoVariable → updateRepoVariable → createRepoVariable → getRepoVariable. Specs on APIs.io.