MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / create_variable

Method create_variable

github/Repository.py:2067–2089  ·  view source on GitHub ↗

:calls: `POST /repos/{owner}/{repo}/actions/variables/{name} `_

(self, variable_name: str, value: str)

Source from the content-addressed store, hash-verified

2065 return github.Secret.Secret(self._requester, url=url)
2066
2067 def create_variable(self, variable_name: str, value: str) -> github.Variable.Variable:
2068 """
2069 :calls: `POST /repos/{owner}/{repo}/actions/variables/{name} <https://docs.github.com/en/rest/actions/variables#create-a-repository-variable>`_
2070 """
2071 assert isinstance(variable_name, str), variable_name
2072 assert isinstance(value, str), value
2073 post_parameters = {
2074 "name": variable_name,
2075 "value": value,
2076 }
2077 self._requester.requestJsonAndCheck("POST", f"{self.url}/actions/variables", input=post_parameters)
2078
2079 quoted_variable_name = urllib.parse.quote(variable_name, safe="")
2080 url = f"{self.url}/actions/variables/{quoted_variable_name}"
2081 return github.Variable.Variable(
2082 self._requester,
2083 url=url,
2084 attributes={
2085 "name": variable_name,
2086 "value": value,
2087 },
2088 completed=False,
2089 )
2090
2091 def get_variables(self) -> PaginatedList[github.Variable.Variable]:
2092 """

Callers 6

testCreateVariableMethod · 0.45
testRepoVariableMethod · 0.45
testRepoVariablesMethod · 0.45

Calls 1

requestJsonAndCheckMethod · 0.80

Tested by

no test coverage detected