Skip to content

assert_branch

assert_branch(assertion_type, m_dir)

Make sure git is using the correct branch based on the workflow.

Parameters:

Name Type Description Default
assertion_type str

Either 'release' or 'hotfix'.

required
m_dir str

The directory for the m configuration.

required

Returns:

Type Description
Res[Config]

A OneOf containing None or an Issue.

Source code in m/ci/assert_branch.py
def assert_branch(assertion_type: str, m_dir: str) -> Res[Config]:
    """Make sure git is using the correct branch based on the workflow.

    Args:
        assertion_type:
            Either 'release' or 'hotfix'.
        m_dir:
            The directory for the m configuration.

    Returns:
        A OneOf containing `None` or an `Issue`.
    """
    return one_of(lambda: [
        config
        for config in cfg_mod.read_config(m_dir)
        for branch in git.get_branch()
        for _ in _verify_branch(config, branch, assertion_type)
    ])