INNER CODE UNIT · Python

write_dry_run

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

def write_dry_run(options, number: int, comment: str | None, embed: dict, png: bytes | None, plan: LabelPlan) -> None:
    out = Path(options.out)
    out.mkdir(parents=True, exist_ok=True)
    if comment:
        (out / f"issue-{number}.md").write_text(comment)
    (out / f"issue-{number}-discord.json").write_text(json.dumps(embed, indent=2, default=str))
    (out / f"issue-{number}-labels.json").write_text(json.dumps({"add": sorted(plan.add), "remove": sorted(plan.remove), "notes": plan.notes}, indent=2))
    if png:
        (out / f"issue-{number}.png").write_bytes(png)
    print(f"Dry run written to {out}")


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)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…