Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions scripts/sync_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import subprocess
import yaml
from pathlib import Path
from github import Github
from github import Auth, Github

REPO_SLUG = os.environ["GITHUB_REPOSITORY"]
TOKEN = os.environ["GITHUB_TOKEN"]
EVENT_NAME = os.environ.get("GITHUB_EVENT_NAME", "")

STATUS_LABELS = {
"pending": "status:pending",
Expand Down Expand Up @@ -122,15 +123,19 @@ def get_changed_task_files(todo_dir: Path) -> list[Path] | None:


def main():
g = Github(TOKEN)
g = Github(auth=Auth.Token(TOKEN))
repo = g.get_repo(REPO_SLUG)
todo_dir = Path("TODO")

if not todo_dir.exists():
print("No TODO directory found.")
return

changed = get_changed_task_files(todo_dir)
# workflow_dispatch has no meaningful HEAD~1 diff — always do full sync
if EVENT_NAME == "workflow_dispatch":
changed = None
else:
changed = get_changed_task_files(todo_dir)

if changed is None:
task_files = [f for f in todo_dir.glob("*.md") if f.name not in SKIP_FILES]
Expand Down
Loading