Fix issues with labeling

This commit is contained in:
Mikhail f. Shiryaev 2022-02-16 17:04:25 +01:00
parent 00c8d74878
commit b2f3a4ccab
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -28,7 +28,10 @@ class Release:
self._release_commit = "" self._release_commit = ""
def run(self, cmd: str, cwd: Optional[str] = None) -> str: def run(self, cmd: str, cwd: Optional[str] = None) -> str:
logging.info("Running in directory %s, command:\n %s", cwd or "$CWD", cmd) cwd_text = ""
if cwd:
cwd_text = f" (CWD='{cwd}')"
logging.info("Running command%s:\n %s", cwd_text, cmd)
return self._git.run(cmd, cwd) return self._git.run(cmd, cwd)
def update(self): def update(self):
@ -201,8 +204,9 @@ class Release:
try: try:
yield yield
except BaseException: except BaseException:
logging.warning("Rolling back label {label}") logging.warning("Rolling back label %s", label)
self.run(f"gh api repos/{args.repo}/labels/{label} -X DELETE") self.run(f"gh api repos/{args.repo}/labels/{label} -X DELETE")
raise
@contextmanager @contextmanager
def _create_gh_release(self, args: argparse.Namespace): def _create_gh_release(self, args: argparse.Namespace):
@ -286,11 +290,6 @@ def parse_args() -> argparse.Namespace:
"works only for a release branches, that name should be the same as " "works only for a release branches, that name should be the same as "
"'$MAJOR.$MINOR' version, e.g. 22.2", "'$MAJOR.$MINOR' version, e.g. 22.2",
) )
parser.add_argument(
"--no-publish-release",
action="store_true",
help="by default, 'major' and 'minor' types work only for master, and 'patch' ",
)
return parser.parse_args() return parser.parse_args()