Example #1
0
from datetime import datetime
from datetime import timezone
from typing import Any
from typing import Dict

from gidgethub import sansio
from gidgethub.aiohttp import GitHubAPI

from marvin import gh_util
from marvin import team
from marvin import triage_runner
from marvin.command_router import CommandRouter
from marvin.gh_util import post_comment
from marvin.gh_util import set_issue_status

command_router = CommandRouter()

AFTER_WARNING_SECONDS = 60 * 60 * 24 * 1  # one day
AWAITING_REVIEWER_TIMEOUT_SECONDS = 60 * 60 * 24 * 3  # three days
AWAITING_MERGER_TIMEOUT_SECONDS = 60 * 60 * 24 * 3  # three days

REVIEW_REMINDER_TEXT = """
**Reminder: Please review!**

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the `needs_reviewer` queue in one day.
""".strip()
MERGE_REMINDER_TEXT = """
**Reminder: Please review!**

Reminder: This Pull Request is **awaiting merger**. If you are the assigned reviewer with commit permission, please have a look. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be put back in the `needs_reviewer` queue in one day.
""".strip()
Example #2
0
import os
from typing import Any
from typing import Dict

from gidgethub import routing
from gidgethub import sansio
from gidgethub.aiohttp import GitHubAPI

from marvin import status
from marvin import triage
from marvin.command_router import CommandRouter

router = routing.Router()
command_router = CommandRouter([status.command_router, triage.command_router])

BOT_NAME = os.environ.get("BOT_NAME", "marvin-mk2")

GREETING = f"""
Hi! I'm an experimental bot. My goal is to guide this PR through its stages, hopefully ending with a merge. You can read up on the usage [here](https://github.com/timokau/marvin-mk2/blob/deployed/USAGE.md).
""".rstrip()


async def handle_comment(
    event: sansio.Event,
    comment: Dict[str, Any],
    issue: Dict[str, Any],
    pull_request_url: str,
    gh: GitHubAPI,
    token: str,
) -> None:
    """React to issue comments"""