import requests


def get_repo_public_key(username: str, repo_name: str, token: str) -> dict:
    """
    Get the public key for a repository via the Github API. At least for private repos, a personal access token (PAT) with the repo scope is required.

    :param username: The users github username
    :param repo_name: The repositories name
    :param token: The PAT of the user with repo scope
    :return: A dict containing the public key and its ID
    """
    query_url = f'https://api.github.com/repos/{username}/{repo_name}/actions/secrets/public-key'
    headers = {'Authorization': f'token {token}'}
    r = requests.get(query_url, headers=headers)

    return r.json()