Skip to content

Commit 0fca78b

Browse files
committed
fix(update): rename github token env var to OP2DEB_GITHUB_TOKEN
The name used to be GITHUB_TOKEN, so that ops2deb would automatically use tokens generated in CI workflows but as it turns out those token don't have the public_repo permission.
1 parent a3ac220 commit 0fca78b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ops2deb/updater.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class GithubUpdateStrategy(BaseUpdateStrategy):
9999
github_url_re = r"^https://github.com/(?P<owner>[\w-]+)/(?P<name>[\w-]+)/"
100100
github_media_type = "application/vnd.github.v3+json"
101101
github_base_api_url = "https://api.github.com"
102+
github_token_env_variable = "OPS2DEB_GITHUB_TOKEN"
102103

103104
@classmethod
104105
def _get_github_repo_api_base_url(cls, blueprint: Blueprint) -> str:
@@ -111,7 +112,8 @@ def _get_github_repo_api_base_url(cls, blueprint: Blueprint) -> str:
111112
async def _get_latest_github_release(self, blueprint: Blueprint) -> dict[str, str]:
112113
repo_api_base_url = self._get_github_repo_api_base_url(blueprint)
113114
headers = {"accept": self.github_media_type}
114-
if (token := os.environ.get("GITHUB_TOKEN")) is not None:
115+
token = os.environ.get(GithubUpdateStrategy.github_token_env_variable)
116+
if token is not None:
115117
headers["authorization"] = f"token {token}"
116118
try:
117119
response = await self.client.get(

0 commit comments

Comments
 (0)