INNER CODE UNIT · Python

deliver

zachlagden/Pi-hole-Optimized-Blocklists · .github/triage/triage/__main__.py:111

def deliver(github: GitHub, discord: Discord | None, options, number: int, comment: str | None, embed: dict, png: bytes | None, plan: LabelPlan, text: str | None = None) -> None:
    if options.dry_run:
        write_dry_run(options, number, comment, embed, png, plan)
        return
    if not plan.empty:
        github.edit_labels(number, plan.add, plan.remove)
    if comment:
        embed["url"] = github.upsert_report(number, comment)
    if plan.notes:
        embed.setdefault("fields", []).append({"name": "Labels set by the AI", "value": "\n".join(plan.notes)[:1000]})
    if discord:
        default = "Triage ran again on an issue." if options.rerun else "New issue needs your review."
        discord.send(text or default, embed, png)


def classify_issue(issue: dict, api_key: str | None) -> tuple[ai_review.Classification | None, LabelPlan]:
    current = {label["name"] for label in issue.get("labels", [])}
    if not api_key:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…