Skip to content

Commit ee8fe41

Browse files
committed
Update center_manager.py
1 parent 3b37689 commit ee8fe41

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

.manager/src/controlman/center_manager.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pyserials as _ps
99
from gittidy import Git as _Git
1010
from loggerman import logger as _logger
11+
import pyshellman as _pyshellman
1112
from versionman.pep440_semver import PEP440SemVer as _PEP440SemVer
1213

1314
from controlman import const
@@ -47,8 +48,8 @@ def __init__(
4748
self._path_cc = cc_path
4849
self._data_before: _ps.NestedDict = data_before
4950
self._data_main: _ps.NestedDict = data_main
50-
self._github_token = github_token
51-
self._github_api = _pylinks.api.github(token=github_token)
51+
self._github_token = github_token or self._get_gh_token()
52+
self._github_api = _pylinks.api.github(token=self._github_token)
5253
self._future_vers = future_versions or {}
5354

5455
self._path_root = self._git.repo_path
@@ -90,6 +91,16 @@ def __init__(
9091
self._changes: list[tuple[str, DynamicFileChangeType]] = []
9192
return
9293

94+
@staticmethod
95+
def _get_gh_token() -> str | None:
96+
return _pyshellman.run(
97+
command=["gh", "auth", "token"],
98+
logger=_logger,
99+
raise_execution=False,
100+
raise_exit_code=False,
101+
raise_stderr=False,
102+
).out
103+
93104
def load(self) -> _ps.NestedDict:
94105
if self._data_raw:
95106
return self._data_raw

0 commit comments

Comments
 (0)