# Path: releasetool/commands/common.py
# class TagContext(GitHubContext):
#     release_pr: Optional[dict] = None
#     release_tag: Optional[str] = None
#     release_version: Optional[str] = None
#     github_release: Optional[dict] = None
#     kokoro_job_name: Optional[str] = None
#     fusion_url: Optional[str] = None
#     token: Optional[str] = None


import getpass
import re
import subprocess
import tempfile
import click
import releasetool.circleci
import releasetool.git
import releasetool.github
import releasetool.secrets
import releasetool.commands.common
from typing import Union
from releasetool.commands.common import TagContext
# limitations under the License.




def _parse_release_tag(output: str) -> str:
    match = re.search("creating release (v.*)", output)
    if match:
        return match[1]
    return None


def kokoro_job_name(upstream_repo: str, package_name: str) -> Union[str, None]:
    """Return the Kokoro job name.

    Args:
        upstream_repo (str): The GitHub repo in the form of `<owner>/<repo>`
        package_name (str): The name of package to release

    Returns:
        The name of the Kokoro job to trigger or None if there is no job to trigger
    """
    repo_short_name = upstream_repo.split("/")[-1]
    return f"cloud-devrel/client-libraries/java/{repo_short_name}/release/stage"


def package_name(pull: dict) -> Union[str, None]:
    return None



# Path: releasetool/commands/common.py
# class TagContext(GitHubContext):
#     release_pr: Optional[dict] = None
#     release_tag: Optional[str] = None
#     release_version: Optional[str] = None
#     github_release: Optional[dict] = None
#     kokoro_job_name: Optional[str] = None
#     fusion_url: Optional[str] = None
#     token: Optional[str] = None


# Path: releasetool/commands/tag/java.py
import getpass
import re
import subprocess
import tempfile
import click
import releasetool.circleci
import releasetool.git
import releasetool.github
import releasetool.secrets
import releasetool.commands.common
from typing import Union
from releasetool.commands.common import TagContext

# limitations under the License.




def _parse_release_tag(output: str) -> str:
    match = re.search("creating release (v.*)", output)
    if match:
        return match[1]
    return None


def kokoro_job_name(upstream_repo: str, package_name: str) -> Union[str, None]:
    """Return the Kokoro job name.

    Args:
        upstream_repo (str): The GitHub repo in the form of `<owner>/<repo>`
        package_name (str): The name of package to release

    Returns:
        The name of the Kokoro job to trigger or None if there is no job to trigger
    """
    repo_short_name = upstream_repo.split("/")[-1]
    return f"cloud-devrel/client-libraries/java/{repo_short_name}/release/stage"


def package_name(pull: dict) -> Union[str, None]:
    return None



def tag(ctx: TagContext = None) -> TagContext: