Create a repo-level variable
POST
/repos/{owner}/{repo}/actions/variables/{variablename}
const url = 'https://gitea.com/api/v1/repos/example/example/actions/variables/example';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"description":"example","value":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.com/api/v1/repos/example/example/actions/variables/example \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "description": "example", "value": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”owner
required
string
Owner of the repo
repo
required
string
Name of the repository
variablename
required
string
Name of the variable
Request Body
Section titled “Request Body”CreateVariableOption the option when creating variable
object
description
Description of the variable to create
string
value
required
Value of the variable to create
string
Examplegenerated
{ "description": "example", "value": "example"}CreateVariableOption the option when creating variable
object
description
Description of the variable to create
string
value
required
Value of the variable to create
string
Responses
Section titled “Responses”Response when creating a repo-level variable
Media typeapplication/json
APIError is error format response
Media typeapplication/json
Headers
Section titled “Headers”message
string
url
string
Variable name already exists.
Media typeapplication/json
APIError is error format response
Media typeapplication/json
Headers
Section titled “Headers”message
string
url
string